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 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. ---------- _______________________________________ 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