Message285904
I think this is just a straight-up interaction bug where we never accounted for the combination of -I with directory and zipfile execution back when -I was added.
From a bug fix perspective, I think the right thing to do in all affected versions would be to add a check to RunMainFromImporter such that it does an insert rather than a set when -I is used.
For 3.7+, it may make sense to change the signature of runpy._run_module_as_main to accept the path entry as Steve suggests, as that could also resolve the quirk where we'll run a __main__ module from *anywhere* on sys.path, rather than only from the given path entry.
The core of the current approach was implemented back in the 2.6 time frame, and then tweaked a bit in 2.7, and hence predates all the niceties offered by the importlib API.
However, the latter change would be a separate RFE rather than a bug fix. |
|
Date |
User |
Action |
Args |
2017-01-20 12:17:06 | ncoghlan | set | recipients:
+ ncoghlan, paul.moore, tim.golden, zach.ware, steve.dower |
2017-01-20 12:17:06 | ncoghlan | set | messageid: <1484914626.53.0.0154400154744.issue29319@psf.upfronthosting.co.za> |
2017-01-20 12:17:06 | ncoghlan | link | issue29319 messages |
2017-01-20 12:17:06 | ncoghlan | create | |
|