summaryrefslogtreecommitdiffstats
path: root/Lib/copy_reg.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-09 17:44:11 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-09 17:44:11 (GMT)
commit47065620f2f83e9b97fc014a14e7d5db6b621c46 (patch)
treed6c7ff0cb150395ae8d04745c1688723f5fa9173 /Lib/copy_reg.py
parent60456fdcfe1c6e8ca84910e3c9213e38aa6eff3c (diff)
downloadcpython-47065620f2f83e9b97fc014a14e7d5db6b621c46.zip
cpython-47065620f2f83e9b97fc014a14e7d5db6b621c46.tar.gz
cpython-47065620f2f83e9b97fc014a14e7d5db6b621c46.tar.bz2
support module for cPickle
Diffstat (limited to 'Lib/copy_reg.py')
-rw-r--r--Lib/copy_reg.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py
new file mode 100644
index 0000000..209eab5
--- /dev/null
+++ b/Lib/copy_reg.py
@@ -0,0 +1,17 @@
+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)
+