diff options
Diffstat (limited to 'Lib/copyreg.py')
-rw-r--r-- | Lib/copyreg.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/copyreg.py b/Lib/copyreg.py index c8a52a2..5783924 100644 --- a/Lib/copyreg.py +++ b/Lib/copyreg.py @@ -25,16 +25,10 @@ def constructor(object): # Example: provide pickling support for complex numbers. -try: - complex -except NameError: - pass -else: +def pickle_complex(c): + return complex, (c.real, c.imag) - def pickle_complex(c): - return complex, (c.real, c.imag) - - pickle(complex, pickle_complex, complex) +pickle(complex, pickle_complex, complex) def pickle_union(obj): import functools, operator |