[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2020-02-07 Thread Maciej Szulik
Change by Maciej Szulik : -- nosy: +maciej.szulik ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-12-15 Thread Nick Coghlan
Nick Coghlan 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 r

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-11-25 Thread Eric Snow
Eric Snow added the comment: In the meantime that leaves the workarounds that @crusaderky originally identified. You could also: * manually run __main__ in the subinterpreter first (sort of like multiprocessing does automatically); this works because the namespace of __main__ is not reset

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-11-25 Thread Eric Snow
Eric Snow added the comment: Yeah, the case of pickle + __main__ is an awkward one. [1] However, the approach taken by multiprocessing isn't the right one for subinterpreters. Multiprocessing operates under 2 design points that do not apply to subinterpreters: * every process is running in

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-11-24 Thread Lewis Gaul
Lewis Gaul added the comment: The relevant code for the multiprocessing example seems to be in Lib/multiprocessing/spawn.py. I think I get what it's doing, but I'm not sure whether we actually need something similar for subinterpreters. Any thoughts @eric.snow? -- _

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-11-24 Thread Lewis Gaul
Lewis Gaul added the comment: Just to move the conversation from the subinterpreters project repo to here... I'm going to take a look at how this is done by subprocess using the example provided by Guido: import os from concurrent.futures import ProcessPoolExecutor from multiprocessing impor

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-06-15 Thread Crusader Ky
New submission from Crusader Ky : As of CPython 3.8.0b1: If one pickles an object that is defined in the __main__ module, sends it to a subinterpreter as bytes, and then tries unpickling it there, it fails saying that __main__ doesn't define it. import _xxsubinterpreters as interpreters imp

[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-06-15 Thread Crusader Ky
Change by Crusader Ky : -- versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail