Staging
v0.8.1
v0.8.1
Revision fa38b3ee749388386914a6584b4c7d97aa474abe authored by cvs2svn on 22 December 1998, 21:43:35 UTC, committed by cvs2svn on 22 December 1998, 21:43:35 UTC
1 parent 45d2ae5
copy_reg.py
# Helper to provide extensibility for pickle/cPickle.
dispatch_table = {}
safe_constructors = {}
def pickle(ob_type, pickle_function, constructor_ob = None):
dispatch_table[ob_type] = pickle_function
if constructor_ob is not None:
constructor(constructor_ob)
def constructor(object):
safe_constructors[object] = 1
# Example: provide pickling support for complex numbers.
def pickle_complex(c):
return complex, (c.real, c.imag)
pickle(type(1j), pickle_complex, complex)
Computing file changes ...