This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients eryksun, ncoghlan, ned.deily, nedbat, steve.dower
Date 2017-03-08.07:56:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488959783.07.0.185640869973.issue29723@psf.upfronthosting.co.za>
In-reply-to
Content
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 front, and not have to try to guess whether or not a different sys.path[0] entry had already been populated.

This would involve splitting RunMainFromImporter into two pieces (one to check whether the given filename is a valid sys.path entry, the second to actually modify sys.path and run __main__), but that's entirely feasible.
History
Date User Action Args
2017-03-08 07:56:23ncoghlansetrecipients: + ncoghlan, nedbat, ned.deily, eryksun, steve.dower
2017-03-08 07:56:23ncoghlansetmessageid: <1488959783.07.0.185640869973.issue29723@psf.upfronthosting.co.za>
2017-03-08 07:56:23ncoghlanlinkissue29723 messages
2017-03-08 07:56:22ncoghlancreate