Message357396
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 import get_context
class C:
def __getstate__(self):
print("pickled in %d" % os.getpid())
return {}
def __setstate__(self, state):
print("unpickled in %d" % os.getpid())
def hello(self):
print("Hello world")
if __name__ == "__main__":
with ProcessPoolExecutor(mp_context=get_context("spawn")) as ex:
ex.submit(C().hello).result()
Output:
pickled in 23480
unpickled in 23485
Hello world |
|
Date |
User |
Action |
Args |
2019-11-24 13:18:20 | LewisGaul | set | recipients:
+ LewisGaul, eric.snow, crusaderky |
2019-11-24 13:18:20 | LewisGaul | set | messageid: <1574601500.01.0.594347235973.issue37292@roundup.psfhosted.org> |
2019-11-24 13:18:19 | LewisGaul | link | issue37292 messages |
2019-11-24 13:18:19 | LewisGaul | create | |
|