Eryk Sun <eryk...@gmail.com> added the comment:

> Agreed it's not a bug, but I will say it took me a while to work out 
> *why* it's not a bug (namely, that even though the OP is using shared 
> memory values, the code relies on fork semantics to share the two 
> Value objects that *reference* the shared memory).

The programming guidelines cover this under "explicitly pass resources to child 
processes" and "the spawn and forkserver start methods". Even for scripts that 
will only ever use the fork start method, it explains why inheriting globals 
may be a problem due to garbage collection in the parent. What can be done to 
make the advice there more visible and easily understood?

I'd guess that, even though it took you a while to spot the problem, you 
wouldn't make the same mistake if writing this from scratch -- assuming you've 
read and understood the programming guidelines. There's nothing about an 
arbitrary Value instance that would allow a spawned child process to map it to 
the shared memory of a Value in the parent process. That information has to be 
pickled and sent to the child.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39255>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to