From ec5f814736f6b3243b08610ed265d651d277fbe6 Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:43:17 -0700 Subject: [PATCH] Fix recursion error when copying Record with deepcopy() --- shapefile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shapefile.py b/shapefile.py index 04fb5ec0..6057d7cd 100644 --- a/shapefile.py +++ b/shapefile.py @@ -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: