summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-06-27 16:58:43 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-06-27 16:58:43 (GMT)
commitf8ecde5de00ad4b11cd1f80aae0f0bd5b99fc66c (patch)
treef91b78ce38e7940105003de01e4259637406e921
parent090a3495b3ff38750192550fd2f80b4c3552cd95 (diff)
downloadcpython-f8ecde5de00ad4b11cd1f80aae0f0bd5b99fc66c.zip
cpython-f8ecde5de00ad4b11cd1f80aae0f0bd5b99fc66c.tar.gz
cpython-f8ecde5de00ad4b11cd1f80aae0f0bd5b99fc66c.tar.bz2
Revert previous checkin and just add a comment about constructor_ob.
There's no point to passing it anymore, but there's a test that expects the call to fail if you pass a non-callable object.
-rw-r--r--Lib/copy_reg.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py
index 97bef41..f499013 100644
--- a/Lib/copy_reg.py
+++ b/Lib/copy_reg.py
@@ -12,7 +12,6 @@ __all__ = ["pickle", "constructor",
dispatch_table = {}
def pickle(ob_type, pickle_function, constructor_ob=None):
- # constructor_ob exists only for backwards compatibility.
if type(ob_type) is _ClassType:
raise TypeError("copy_reg is not intended for use with classes")
@@ -20,9 +19,12 @@ def pickle(ob_type, pickle_function, constructor_ob=None):
raise TypeError("reduction functions must be callable")
dispatch_table[ob_type] = pickle_function
+ # The constructor_ob function is a vestige of safe for unpickling.
+ # There is no reason for the caller to pass it anymore.
+ if constructor_ob is not None:
+ constructor(constructor_ob)
+
def constructor(object):
- # XXX This function should be deprecated. It is a vestige of
- # the old __safe_for_unpickling__ code.
if not callable(object):
raise TypeError("constructors must be callable")