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 <>
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
- if __main__.__spec__ is set, pickle will use 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:56ncoghlansetrecipients: + ncoghlan, brett.cannon, pitrou, larry, alexandre.vassalotti, Arfrever, eric.snow
2013-12-17 12:40:56ncoghlansetmessageid: <>
2013-12-17 12:40:56ncoghlanlinkissue19702 messages
2013-12-17 12:40:56ncoghlancreate