Nick Coghlan added the comment:

Work in progress PR at https://github.com/python/cpython/pull/571

I also came up with a reasonably straightforward way of defining the desired 
"sys.path" initialisation behaviour, which is that the following should all get 
the *same* sys.path entries:

    python3 -S script_dir/__main__.py
    python3 -S script_dir
    python3 -I script_dir

None of those should have the current directory on sys.path, but they should 
*all* have `script_dir` as the first entry on sys.path (and it will be absolute 
by the time user code runs, even though RunMainAsImporter itself doesn't yet 
ensure that).

They all differ from the `python3 -m script_dir` and `python3 -m 
script_dir.__main__` cases, as those are the exact opposite: they *should* have 
the current directory as the first entry on sys.path and *should not* have 
`script_dir` in sys.path at all.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29723>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to