From fa5c550d1f2591d040a884cc9d20bf8399507e49 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 10 Apr 2024 17:07:32 -0500 Subject: [PATCH] Fix for python 3.12 --- .github/workflows/pytest.yml | 1 + src/sos/targets.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4f49096b8..80c53045c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -31,4 +31,5 @@ jobs: run: | cd test sh build_test_docker.sh + echo "Running tests" python run_tests.py diff --git a/src/sos/targets.py b/src/sos/targets.py index b7abf3ee2..c5e010049 100644 --- a/src/sos/targets.py +++ b/src/sos/targets.py @@ -528,7 +528,12 @@ class file_target(path, BaseTarget): """A regular target for files.""" def __init__(self, *args, **kwargs): - path.__init__(self) + if sys.version_info[0] >= 3 and sys.version_info[1] >= 12: + # python 3.12 and above + path.__init__(self, *args, **kwargs) + else: + # python 2.10 and 3.11 + path.__init__(self) BaseTarget.__init__(self, *args, **kwargs) if len(args) == 1 and isinstance(args[0], file_target): self._md5 = args[0]._md5 if hasattr(args[0], '_md5') else None