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 eryksun
Recipients Kallah, eryksun, paul.moore, steve.dower, steven.daprano, tim.golden, zach.ware
Date 2020-01-08.11:38:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578483539.2.0.340837255663.issue39255@roundup.psfhosted.org>
In-reply-to
Content
> I am not going to close it as I am unsure if it is by design that 
> Windows and Unix python acts differently.

For compatibility, a script should support the spawn start method. Spawning child processes is the only available start method in Windows, and, as of Python 3.8 (see issue 33725), it's the default start method in macOS. This entails passing picklable objects as arguments or with a multiprocessing.Queue or multiprocessing.Pipe -- instead of relying on global values that get inherited via fork. 

With a pool you can set up globals with an initializer function. Here's an example of the latter that manually selects the spawn start method:

    import multiprocessing as mp

    def pool_init(x_value, y_value):
        global x, y
        x = x_value
        y = y_value

    if __name__ == '__main__':
        mp.set_start_method('spawn')
        pool = mp.Pool(processes=2, initializer=pool_init,
                        initargs=(mp.Value('i', 0), mp.Value('i', 0)))
History
Date User Action Args
2020-01-08 11:38:59eryksunsetrecipients: + eryksun, paul.moore, tim.golden, steven.daprano, zach.ware, steve.dower, Kallah
2020-01-08 11:38:59eryksunsetmessageid: <1578483539.2.0.340837255663.issue39255@roundup.psfhosted.org>
2020-01-08 11:38:59eryksunlinkissue39255 messages
2020-01-08 11:38:58eryksuncreate