From 2858fd1957e59429071f97e38f40e424990d9c7b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 7 Jun 2003 20:09:43 +0000 Subject: [PATCH] Patch #750595: Refer to type complex using builtin. Fixes #595837. --- Lib/copy_reg.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 -- 2.47.3