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 brett.cannon
Recipients brett.cannon, sbt
Date 2013年02月28日.01:03:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362013434.84.0.815940132297.issue17314@psf.upfronthosting.co.za>
In-reply-to
Content
It is an abuse since I didn't design that part of the API to function that way, but it's cool that it just happens to. =)
I do see your use-case and it is legitimate, although extremely rare and narrow. Let me think about whether I want to add specific support either through your approach, Richard, or if I want to decouple the setting of module attributes so that it is more along the lines of::
 main_module = imp.new_module('__mp_main__')
 loader.set_attributes(main_module) # BRAND-NEW; maybe private to the stdlib?
 main_module.__name__ = '__mp_main__'
 code_object = loader.get_code(main_name)
 sys.modules['__main__'] = sys.modules['__mp_main__'] = main_module # OLD
 exec(code_object, main_module.__dict__)
I'm currently leaning towards the latter option since it's an annoying bit to get right and it doesn't hurt anything to expose.
History
Date User Action Args
2013年02月28日 01:03:54brett.cannonsetrecipients: + brett.cannon, sbt
2013年02月28日 01:03:54brett.cannonsetmessageid: <1362013434.84.0.815940132297.issue17314@psf.upfronthosting.co.za>
2013年02月28日 01:03:54brett.cannonlinkissue17314 messages
2013年02月28日 01:03:54brett.cannoncreate

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