Message206427
Issue 19700 means that runpy now ensures that __main__.__spec__ is set appropriately when __main__ is executed via the import system.
Issue 19946 means that multiprocessing now ensures that __main__ is configured correctly in child processes to reference a properly initialised "fake main" to allow pickle compatibility with classes and functions defined in __main__ outside "if __name__ == '__main__'" guards.
The proposal here is that we make the following changes:
- runpy will ensure that when __main__ is executed via the import system, it will also be aliased in sys.modules as __spec__.name
- if __main__.__spec__ is set, pickle will use __spec__.name rather than __name__ to pickle classes, functions and methods defined in __main__
- multiprocessing is updated appropriately to skip creating __mp_main__ in child processes when __main__.__spec__ is set in the parent process
While I still think this is a reasonable idea, I think it qualifies as a new feature, and hence is better postponed to Python 3.5 |
|
Date |
User |
Action |
Args |
2013-12-17 12:40:56 | ncoghlan | set | recipients:
+ ncoghlan, brett.cannon, pitrou, larry, alexandre.vassalotti, Arfrever, eric.snow |
2013-12-17 12:40:56 | ncoghlan | set | messageid: <1387284056.83.0.737071634757.issue19702@psf.upfronthosting.co.za> |
2013-12-17 12:40:56 | ncoghlan | link | issue19702 messages |
2013-12-17 12:40:56 | ncoghlan | create | |
|