[issue29795] Clarify how to share multiprocessing primitives

2017-03-12 Thread Davin Potts
Changes by Davin Potts : -- resolution: -> works for me stage: needs patch -> resolved status: open -> closed ___ Python tracker ___

[issue29795] Clarify how to share multiprocessing primitives

2017-03-12 Thread Max
Max added the comment: Actually, never mind, I think one of the paragraphs in the Programming Guidelines ("Explicitly pass resources to child processes") basically explains everything already. I just didn't notice it until @noxdafox pointed it out to me on SO. Close please. -- _

[issue29795] Clarify how to share multiprocessing primitives

2017-03-12 Thread Max
Max added the comment: Somewhat related is this statement from Programming Guidelines: > When using the spawn or forkserver start methods many types from > multiprocessing need to be picklable so that child processes can use them. > However, one should generally avoid sending shared objects to

[issue29795] Clarify how to share multiprocessing primitives

2017-03-11 Thread Max
Max added the comment: How about inserting this text somewhere: Note that sharing and synchronization objects (such as `Queue()`, `Pipe()`, `Manager()`, `Lock()`, `Semaphore()`) should be made available to a new process by passing them as arguments to the `target` function invoked by the `run(

[issue29795] Clarify how to share multiprocessing primitives

2017-03-11 Thread Davin Potts
Davin Potts added the comment: On Windows, because that OS does not support fork, multiprocessing uses spawn to create new processes by default. Note that in Python 3, multiprocessing provides the user with a choice of how to create new processes (i.e. fork, spawn, forkserver). When fork is

[issue29795] Clarify how to share multiprocessing primitives

2017-03-11 Thread Max
New submission from Max: 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()