Nick Coghlan <ncogh...@gmail.com> added the comment:

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.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37292>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to