# 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
grp = None
# os.symlink on Windows prior to 6.0 raises NotImplementedError
-symlink_exception = (AttributeError, NotImplementedError)
-try:
- # OSError (winerror=1314) will be raised if the caller does not hold the
- # SeCreateSymbolicLinkPrivilege privilege
- symlink_exception += (OSError,)
-except NameError:
- pass
+# OSError (winerror=1314) will be raised if the caller does not hold the
+# SeCreateSymbolicLinkPrivilege privilege
+symlink_exception = (AttributeError, NotImplementedError, OSError)
# from tarfile import *
__all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError", "ReadError",