aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/copyreg.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/copyreg.py')
-rw-r--r--Lib/copyreg.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/copyreg.py b/Lib/copyreg.py
index 356db6f083e..c8a52a2dc63 100644
--- a/Lib/copyreg.py
+++ b/Lib/copyreg.py
@@ -89,6 +89,10 @@ def _reduce_ex(self, proto):
except AttributeError:
dict = None
else:
+ if (type(self).__getstate__ is object.__getstate__ and
+ getattr(self, "__slots__", None)):
+ raise TypeError("a class that defines __slots__ without "
+ "defining __getstate__ cannot be pickled")
dict = getstate()
if dict:
return _reconstructor, args, dict