]> granicus.if.org Git - python/commitdiff
Revert previous checkin and just add a comment about constructor_ob.
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Jun 2003 16:58:43 +0000 (16:58 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Jun 2003 16:58:43 +0000 (16:58 +0000)
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.

Lib/copy_reg.py

index 97bef4100f64a6bf5231fc8fc3737946c690c9eb..f4990130fb3bd409640d9f81570541d91bdaf0cb 100644 (file)
@@ -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")