summaryrefslogtreecommitdiff
path: root/Lib/copyreg.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-11-23 18:59:12 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-11-23 18:59:12 +0100
commitc9dc4a2a8a6dcfe1674685bea4a4af935c0e37ca (patch)
treeafbde5318538e73815668dc73a0fb91dfb88ca61 /Lib/copyreg.py
parent95401c5f6b9f07b094924559177c9b30a1c38998 (diff)
downloadcpython-git-c9dc4a2a8a6dcfe1674685bea4a4af935c0e37ca.tar.gz
Issue #17810: Implement PEP 3154, pickle protocol 4.
Most of the work is by Alexandre.
Diffstat (limited to 'Lib/copyreg.py')
-rw-r--r--Lib/copyreg.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/copyreg.py b/Lib/copyreg.py
index 66c0f8a64d..67f5bb029e 100644
--- a/Lib/copyreg.py
+++ b/Lib/copyreg.py
@@ -87,6 +87,12 @@ def _reduce_ex(self, proto):
def __newobj__(cls, *args):
return cls.__new__(cls, *args)
+def __newobj_ex__(cls, args, kwargs):
+ """Used by pickle protocol 4, instead of __newobj__ to allow classes with
+ keyword-only arguments to be pickled correctly.
+ """
+ return cls.__new__(cls, *args, **kwargs)
+
def _slotnames(cls):
"""Return a list of slot names for a given class.