diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-06-07 20:10:54 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-06-07 20:10:54 (GMT) |
commit | 502ba4630358423dc3da4da0f3f938d3cb56281f (patch) | |
tree | 6d32298ff3d203a25a99dc3d3adbd2e1e8d02d71 | |
parent | 56f88113b7272be8403f9b722c943e679e23d362 (diff) | |
download | cpython-502ba4630358423dc3da4da0f3f938d3cb56281f.zip cpython-502ba4630358423dc3da4da0f3f938d3cb56281f.tar.gz cpython-502ba4630358423dc3da4da0f3f938d3cb56281f.tar.bz2 |
Patch #750595: Refer to type complex using builtin. Fixes #595837.
Backported to 2.2.
-rw-r--r-- | Lib/copy_reg.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 2ebafc7..0477bcb 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -28,10 +28,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 pickling new-style objects |