]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #750595: Refer to type complex using builtin. Fixes #595837.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 7 Jun 2003 20:09:43 +0000 (20:09 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 7 Jun 2003 20:09:43 +0000 (20:09 +0000)
Lib/copy_reg.py

index 8a3550aad3ff4e24dbe5cf3adc611ba7b9740e42..13a48b2963e964019702f87f507a73d4d1613be9 100644 (file)
@@ -29,10 +29,16 @@ def constructor(object):
 
 # Example: provide pickling support for complex numbers.
 
-def pickle_complex(c):
-    return complex, (c.real, c.imag)
+try:
+    complex
+except NameError:
+    pass
+else:
 
-pickle(type(1j), pickle_complex, complex)
+    def pickle_complex(c):
+        return complex, (c.real, c.imag)
+
+    pickle(complex, pickle_complex, complex)
 
 # Support for picking new-style objects