Skip to content

Commit

Permalink
Merge pull request #257 from midichef/deepcopy
Browse files Browse the repository at this point in the history
Fix recursion error when copying Record with deepcopy()
  • Loading branch information
GeospatialPython authored Jan 20, 2024
2 parents b38bf9c + ec5f814 commit 66ae197
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shapefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,8 @@ def __getattr__(self, item):
corresponding value in the Record does not exist
"""
try:
if item == "__setstate__": # Prevent infinite loop from copy.deepcopy()
raise AttributeError('_Record does not implement __setstate__')
index = self.__field_positions[item]
return list.__getitem__(self, index)
except KeyError:
Expand Down

0 comments on commit 66ae197

Please sign in to comment.