diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-26 23:20:20 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-26 23:20:20 (GMT) |
commit | 7567822838b915d3464fd87c54fdd574d67e7aa9 (patch) | |
tree | 3fa9fadaecd37962724042c44bd21c046ae36923 | |
parent | d0cda1dc9fc4c7aa06c4f330d576782ac03b3728 (diff) | |
download | cpython-7567822838b915d3464fd87c54fdd574d67e7aa9.zip cpython-7567822838b915d3464fd87c54fdd574d67e7aa9.tar.gz cpython-7567822838b915d3464fd87c54fdd574d67e7aa9.tar.bz2 |
Don't call constructor() from pickle().
The constructor() call only made sense when it registered the
constructor as safe for unpickling. We should probably remove the
module-global function, but need to worry about backwards
compatibility.
-rw-r--r-- | Lib/copy_reg.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 0477bcb..97bef41 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -12,6 +12,7 @@ __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") @@ -19,10 +20,9 @@ def pickle(ob_type, pickle_function, constructor_ob=None): raise TypeError("reduction functions must be callable") dispatch_table[ob_type] = pickle_function - 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") |