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 max
Recipients docs@python, max
Date 2017-03-11.19:25:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489260349.05.0.251290010989.issue29795@psf.upfronthosting.co.za>
In-reply-to
Content
It seems both me and many other people (judging from SO questions) are confused about whether it's ok to write this:

from multiprocessing import Process, Queue
q = Queue()

def f():
    q.put([42, None, 'hello'])

def main():
    p = Process(target=f)
    p.start()
    print(q.get())    # prints "[42, None, 'hello']"
    p.join()

if __name__ == '__main__':
    main()

It's not ok (doesn't work on Windows presumably because somehow when it's pickled, the connection between global queues in the two processes is lost; works on Linux, because I guess fork keeps more information than pickle, so the connection is maintained).

I thought it would be good to clarify in the docs that all the Queue() and Manager().* and other similar objects should be passed as parameters not just defined as globals.
History
Date User Action Args
2017-03-11 19:25:49maxsetrecipients: + max, docs@python
2017-03-11 19:25:49maxsetmessageid: <1489260349.05.0.251290010989.issue29795@psf.upfronthosting.co.za>
2017-03-11 19:25:48maxlinkissue29795 messages
2017-03-11 19:25:48maxcreate