Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions Lib/copyreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This alias is now only used once in this file. You could just inline it here:

except symlink_exception:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone out there might be using it. So, I went with the safest path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I guess so!


# from tarfile import *
__all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError", "ReadError",
Expand Down