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, alexandre.vassalotti, brett.cannon, eric.snow, larry, ncoghlan, pitrou
Date 2013-12-17.12:40:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387284056.83.0.737071634757.issue19702@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-12-17 12:40:56ncoghlansetrecipients: + ncoghlan, brett.cannon, pitrou, larry, alexandre.vassalotti, Arfrever, eric.snow
2013-12-17 12:40:56ncoghlansetmessageid: <1387284056.83.0.737071634757.issue19702@psf.upfronthosting.co.za>
2013-12-17 12:40:56ncoghlanlinkissue19702 messages
2013-12-17 12:40:56ncoghlancreate