summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/copy_reg.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py
index d469744..92cbd53 100644
--- a/Lib/copy_reg.py
+++ b/Lib/copy_reg.py
@@ -46,7 +46,7 @@ _HEAPTYPE = 1<<9
def _reduce(self):
for base in self.__class__.__mro__:
- if not base.__flags__ & _HEAPTYPE:
+ if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE:
break
else:
base = object # not really reachable
@@ -56,9 +56,14 @@ def _reduce(self):
state = base(self)
args = (self.__class__, base, state)
try:
- dict = self.__dict__
+ getstate = self.__getstate__
except AttributeError:
- dict = None
+ try:
+ dict = self.__dict__
+ except AttributeError:
+ dict = None
+ else:
+ dict = getstate()
if dict:
return _reconstructor, args, dict
else: