mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Backported to 2.2.
This commit is contained in:
parent
56f88113b7
commit
502ba46303
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue