> It's actually "adding" the current directory
It's the script directory, which gets added on all platforms when PySys_SetArgv is called with Py_IsolatedFlag == 0. In this case we're running "__main__.py" from a directory or zip file, and we don't want its parent directory in sys.path.
> The behavior on Windows is correct
Here's what I see on a current build of 3.6:
C:\Temp>python_d -i main361
>>> import sys
>>> sys.version
'3.6.0+ (default, Mar 8 2017, 06:51:22) [MSC v.1900 64 bit (AMD64)]'
>>> sys.path[:2]
['main361', 'C:\\Temp']
C:\Temp doesn't belong in sys.path in this case. When we're not in isolated mode, RunMainFromImporter should set the __main__.py import source as index 0 rather than insert it. |