gh-99325: Remove unused `NameError` handling (#99326)

This commit is contained in:
Nikita Sobolev 2022-11-11 12:56:57 +03:00 committed by GitHub
parent e00d730efe
commit faf7dfa656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 16 deletions

View File

@ -25,16 +25,10 @@ def constructor(object):
# Example: provide pickling support for complex numbers. # Example: provide pickling support for complex numbers.
try: def pickle_complex(c):
complex return complex, (c.real, c.imag)
except NameError:
pass
else:
def pickle_complex(c): pickle(complex, pickle_complex, complex)
return complex, (c.real, c.imag)
pickle(complex, pickle_complex, complex)
def pickle_union(obj): def pickle_union(obj):
import functools, operator import functools, operator

View File

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