[issue30152] Reduce the number of imports for argparse

Serhiy Storchaka report at bugs.python.org
Sun Sep 24 04:14:26 EDT 2017


Serhiy Storchaka added the comment:

Got rid of importing errno as Victor suggested. In gettext its import is deferred. It is only used in one exceptional case. In os errno no longer used.

Initially errno was imported in os inside a function. The import was moved at module level for fixing issue1755179. But now we can get rid of it totally by catching specialized OSError subclasses instead of testing the OSError's errno attribute.

There are other cleaning up changes in the os._execvpe() function. os.path.split() is replaced with os.path.dirname() since only the dirname is used. Saving tracebacks no longer needed because a traceback is a part of an exception in Python 3.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30152>
_______________________________________


More information about the Python-bugs-list mailing list