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 LewisGaul, crusaderky, eric.snow, ncoghlan
Date 2019-12-15.12:46:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576413988.08.0.758808735482.issue37292@roundup.psfhosted.org>
In-reply-to
Content
There's a reason multiprocessing in spawn mode jumps through the hoops that it does: it's the only way to get __main__ pickling to work when you're not forking the entire process.

You also don't want to naively re-run __main__ in the subprocess for the same reason multiprocessing doesn't: doing so would also re-run the script parts, not just the class and function definition parts.

So while I don't think it should be implicit the way it is for multiprocessing spawn mode, I do think it would make sense to offer a way to explicitly opt-in to re-running __main__ in a child interpreter as "__si_main__", aliasing the subinterpreter's __main__ module to that, and also aliasing "__si_main__" to "__main__" in the parent interpreter.
History
Date User Action Args
2019-12-15 12:46:28ncoghlansetrecipients: + ncoghlan, eric.snow, crusaderky, LewisGaul
2019-12-15 12:46:28ncoghlansetmessageid: <1576413988.08.0.758808735482.issue37292@roundup.psfhosted.org>
2019-12-15 12:46:28ncoghlanlinkissue37292 messages
2019-12-15 12:46:27ncoghlancreate