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 LewisGaul
Recipients LewisGaul, crusaderky, eric.snow
Date 2019-11-24.13:18:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574601500.01.0.594347235973.issue37292@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-11-24 13:18:20LewisGaulsetrecipients: + LewisGaul, eric.snow, crusaderky
2019-11-24 13:18:20LewisGaulsetmessageid: <1574601500.01.0.594347235973.issue37292@roundup.psfhosted.org>
2019-11-24 13:18:19LewisGaullinkissue37292 messages
2019-11-24 13:18:19LewisGaulcreate