Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 71606f8dd950604620efb37b86e81ee03f9d232b authored by cvs2svn on 15 May 1997, 12:24:53 UTC
This commit was manufactured by cvs2svn to create tag 'r15a2'.
Tip revision: 71606f8
copy_reg.py
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

def pickle_complex(c):
    return complex,(c.real, c.imag)

pickle(type(1j),pickle_complex,complex)

back to top