[3.7] bpo-33053: -m now adds starting directory to sys.path (GH-6231) by ncoghlan · Pull Request #6236 · python/cpython (original) (raw)

Copy link

Contributor

@ncoghlan ncoghlan commented

Mar 25, 2018

edited by bedevere-bot

Loading

Historically, -m added the empty string as sys.path
zero, meaning it resolved imports against the current
working directory, the same way -c and the interactive
prompt do.

This changes the sys.path initialisation to add the
starting working directory as sys.path[0] instead,
such that changes to the working directory while the
program is running will have no effect on imports
when using the -m switch.

(cherry picked from commit d5d9e02)

https://bugs.python.org/issue33053