Skip to content

Commit

Permalink
Fix for python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
BoPeng committed Apr 10, 2024
1 parent 1720da9 commit fa5c550
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ jobs:
run: |
cd test
sh build_test_docker.sh
echo "Running tests"
python run_tests.py
7 changes: 6 additions & 1 deletion src/sos/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa5c550

Please sign in to comment.