Skip to content

Commit 66ae197

Browse files
Merge pull request #257 from midichef/deepcopy
Fix recursion error when copying Record with deepcopy()
2 parents b38bf9c + ec5f814 commit 66ae197

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

shapefile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ def __getattr__(self, item):
730730
corresponding value in the Record does not exist
731731
"""
732732
try:
733+
if item == "__setstate__": # Prevent infinite loop from copy.deepcopy()
734+
raise AttributeError('_Record does not implement __setstate__')
733735
index = self.__field_positions[item]
734736
return list.__getitem__(self, index)
735737
except KeyError:

0 commit comments

Comments
 (0)