[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

Nick Coghlan report at bugs.python.org
Sun Apr 8 00:48:45 EDT 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Some notes from my investigation of bpo-33185 that seem more appropriate here, rather than on that issue:

* several of the developer-centric utilities in the standard library have a shared need to be friendly to imports from the current working directory.
* timeit uses os.curdir, but could be switched to os.getcwd()
* pydoc uses a literal '.', but could be switched to os.getcwd()
* trace, profile, cProfile, pdb, doctest, and IDLE's pyshell all add the directory containing the file under test

Aside from switching pydoc from a literal '.' to os.curdir, I'm not going to change any of those (hence why I'm putting these notes here), but I wanted to capture this info in case does decide to follow through on a "less isolated than isolated mode, but still omits the current directory from sys.path" execution mode.

----------

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


More information about the Python-bugs-list mailing list