Message183194
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. |
|
Date |
User |
Action |
Args |
2013-02-28 01:03:54 | brett.cannon | set | recipients:
+ brett.cannon, sbt |
2013-02-28 01:03:54 | brett.cannon | set | messageid: <1362013434.84.0.815940132297.issue17314@psf.upfronthosting.co.za> |
2013-02-28 01:03:54 | brett.cannon | link | issue17314 messages |
2013-02-28 01:03:54 | brett.cannon | create | |
|