From: Martin v. Löwis Date: Sat, 7 Jun 2003 20:09:43 +0000 (+0000) Subject: Patch #750595: Refer to type complex using builtin. Fixes #595837. X-Git-Tag: 2.2~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2858fd1957e59429071f97e38f40e424990d9c7b;p=thirdparty%2FPython%2Fcpython.git Patch #750595: Refer to type complex using builtin. Fixes #595837. --- diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 8a3550aad3ff..13a48b2963e9 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -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