[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2018-01-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -585 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-05-17 Thread Eric Snow
Changes by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-24 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset d2977a3ae2cc6802921b1e3b6e9d13fcfbda872d by Nick Coghlan in branch 'master': bpo-29723: Consistently configure sys.path[0] (#575) https://github.com/python/cpython/commit/d2977a3ae2cc6802921b1e3b6e9d13fcfbda872d -- ___

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-24 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset 27abb0e533a6f7ad195bd56b064c32164296a56e by Nick Coghlan in branch 'master': bpo-29723: Add missing NEWS entry (#638) https://github.com/python/cpython/commit/27abb0e533a6f7ad195bd56b064c32164296a56e -- ___

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-24 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset c60948464fb0ec116ea227f6bce8a4bb8fb75257 by Nick Coghlan in branch '3.6': [3.6] bpo-29723: Consistently configure sys.path[0] (#636) https://github.com/python/cpython/commit/c60948464fb0ec116ea227f6bce8a4bb8fb75257 --

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-24 Thread Ned Deily
Ned Deily added the comment: New changeset 75345c552d0889f4f63039d6063f371846c8f41f by Ned Deily (Nick Coghlan) in branch '3.6': [3.6] bpo-29723: Consistently configure sys.path[0] (#636) https://github.com/python/cpython/commit/75345c552d0889f4f63039d6063f371846c8f41f -- ___

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-17 Thread Larry Hastings
Changes by Larry Hastings : -- pull_requests: +585 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-12 Thread Steve Dower
Steve Dower added the comment: Thanks, Nick! I agree that this alone isn't worth a second RC, though if we fix another "nearly worth it" (especially anything related to the github transition) we may want to consider it still. Ned - I'd be okay to sneak out another release this week if we want,

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-12 Thread Nick Coghlan
Nick Coghlan added the comment: Noting for the record: Steve reviewed & approved the original PR before I merged that and did the backport to 3.6. With the new test case ensuring sys.path configuration consistency and Paul's report of success when checking the original problem from issue 29319

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-12 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +527 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-12 Thread Nick Coghlan
Nick Coghlan added the comment: I've merged PR 575 to master, and 636 is pending a successful Travis run for 3.6. Both branches still need NEWS entries- I'll do those as independent PRs rather than cherry-picking (since cherry picking NEWS changes is currently still doomed to fail) -

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-12 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +524 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-10 Thread Nick Coghlan
Nick Coghlan added the comment: Paul Moore reporting on trying out the new PR in http://bugs.python.org/issue29319#msg289357 and confirmed that it still solves the originally reported problem in issue 29319. -- ___ Python tracker

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Changes by Nick Coghlan : -- versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Nick Coghlan added the comment: OK, https://github.com/python/cpython/pull/575 is the new PR that covers everything needed to fix the root cause of the problem (which was the entirely unnecessary add-and-overwrite dance that zipfile and directory executation was doing for sys.path[0]) ---

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +471 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Nick Coghlan added the comment: Slightly correction, as I didn't have the isolated mode equivalents quite correct: python3 -s script_dir/__main__.py python3 -s script_dir python3 -I script_dir Isolated mode still runs the system site.py, which turns out to be signficant in a devel

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
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: pytho

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +467 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan
Nick Coghlan added the comment: As Eryk notes, this has revealed a separate bug in that we don't make the path absolute when adding to sys.path. However, that's *not* directly related to the regression, so I'm resisting the temptation to change it here. Instead, the new test case I'm adding wi

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Eryk Sun
Eryk Sun added the comment: main361 can be run as a package from the current directory via -m because an empty string is in sys.path, i.e. the current directory. It imports the package, executing __init__.py and then __main__.py. In this case, the main361 directory/zip import source is not add

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Steve Dower
Steve Dower added the comment: > C:\Temp doesn't belong in sys.path in this case Hang on, why not? If I were running a module.py then it would be, so why is a package\__main__.py different (and not able to import itself or its siblings)? The package is the "script" being run here, yes? Or is

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-07 Thread Nick Coghlan
Nick Coghlan added the comment: So a potentially more robust fix here would be to always call `PySys_SetArgVEx(argc, argv, 0)` rather than the plain `PySys_SetArgV` when we know we're going to be relying on RunMainFromImporter. That way RunMainFromImporter could just *always* insert at the fro

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-07 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, interesting, I didn't know there was a difference between the platforms in when the placeholder got resolved to a full path. However, after browsing the code and running some local tests, it seems that injecting sys.path[0] isn't handled by Py_GetPath() or P

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-07 Thread Eryk Sun
Eryk Sun added the comment: > 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 di

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-07 Thread Steve Dower
Steve Dower added the comment: It's actually "adding" the current directory by not replacing the empty string that's normally there, presumably because it's already been resolved into a path at this stage. The behavior on Windows is correct, so I expect it's actually a difference between getpa

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-06 Thread Ned Deily
Ned Deily added the comment: Thanks for the analysis, Eryk and Nick. Then this sounds like a release blocker problem that should be fixed for 3.6.1. Steve, can you take a look, please? -- nosy: +steve.dower priority: normal -> release blocker stage: -> needs patch type: -> behavior

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-06 Thread Nick Coghlan
Nick Coghlan added the comment: I think Eryk's diagnosis is correct: this is a straight up bug in the original patch, where it's missing the check to only use the new logic when in isolated mode (as it's compensating for the fact that there is no extra sys.path[0] entry inserted in that case).

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun
Eryk Sun added the comment: > I don't have a specific problem that it causes. Adding an arbitrary directory ahead of the standard library in sys.path is a problem waiting to happen. This also happens when the import source is a zip file, e.g. a .pyz app. -- _

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Batchelder
Ned Batchelder added the comment: I don't have a specific problem that it causes. It's just a difference from any previous CPython version. About the PyPy thing: it has always behaved this way: $ for ver in 4.0.1 5.1.1 5.4.0 5.6.0; do py=/usr/local/pythonz/pythons/PyPy-$ver/bin/pypy; $py -V;

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun
Eryk Sun added the comment: That's not the current directory. It's the 'script' directory (i.e. the parent of main361), as set by PySys_SetArgv when Py_IsolatedFlag isn't set. The old behavior was for RunMainFromImporter to unconditionally replace this directory in sys.path with the import so

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Deily
Ned Deily added the comment: I think this is a result of the changes introduced with Issue29319. Perhaps a more prominent NEWS entry is needed? Nick? Ned, does this change in behavior cause problems? -- nosy: +ncoghlan, ned.deily ___ Python track

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, I don't know if this is relevant, but PyPy has added the current directory in this situation for a long time. -- ___ Python tracker ___ __

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Ned Batchelder
New submission from Ned Batchelder: 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py Previous versions, including 3.6.0, did not. Is this intentional? $ pwd /Users/ned/foo $ cat main361/__main__.py import pprint, sys pprint.pprint(sys.path) $ for ver in