Skip to content

Commit

Permalink
GH-467: fix ArtifactoryPath.__reduce__ for python 3.9 and below
Browse files Browse the repository at this point in the history
  • Loading branch information
miskeens committed Jan 10, 2025
1 parent 568707e commit 5319f97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,13 @@ def __reduce__(self):
# pathlib.PurePath.__reduce__ doesn't include instance state, but we
# have state that needs to be included when pickling
pathlib_reduce = super().__reduce__()
return pathlib_reduce[0], pathlib_reduce[1], self.__dict__
# pathlib.Path in 3.10+ does not have __slots__, so self.__dict__ is available;
# in 3.9 and earlier there is no self.__dict__. return slots instead
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
attributes = self.__dict__
else:
attributes = {x: getattr(self, x) for x in self.__slots__}
return pathlib_reduce[0], pathlib_reduce[1], attributes

@property
def top(self):
Expand Down

0 comments on commit 5319f97

Please sign in to comment.