homepage

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 Arfrever, brett.cannon, eric.snow, larry, ncoghlan
Date 2013年12月08日.13:59:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386511195.29.0.159366007985.issue19700@psf.upfronthosting.co.za>
In-reply-to
Content
Deleted a bunch of code, and runpy now correctly sets both __file__ and __cached__ (runpy previously never set the latter properly).
You can also see the reason for my rant above in the form of runpy._fixed_find_spec. importlib.find_loader was always kind of useless in end user code that needed to handle arbitrary modules, you needed to use the pkgutil.get_loader wrapper instead. It would be nice if importlib.find_spec "just worked", instead of only working for top level modules. At the very least, it should fail noisily if a dotted name is passed in without specifying a path argument.
I may have argued in favour of the side effect free find_loader in the past, if I have, consider this me admitting I was wrong after wasting a bunch of time hunting down unexpected import errors in test_runpy after the initial conversion to using find_spec.
There's one final change needed to address the pickle-in-main compatibility issue: runpy has to alias the module under its real name as well as __main__. Once it does that, then using __spec__.name (when available) should ensure pickle does the right thing.
History
Date User Action Args
2013年12月08日 13:59:55ncoghlansetrecipients: + ncoghlan, brett.cannon, larry, Arfrever, eric.snow
2013年12月08日 13:59:55ncoghlansetmessageid: <1386511195.29.0.159366007985.issue19700@psf.upfronthosting.co.za>
2013年12月08日 13:59:55ncoghlanlinkissue19700 messages
2013年12月08日 13:59:54ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /