[issue39255] Windows and Unix run-time differences

Eryk Sun report at bugs.python.org
Wed Jan 8 12:53:04 EST 2020


Eryk Sun <eryksun at 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 <report at bugs.python.org>
<https://bugs.python.org/issue39255>
_______________________________________


More information about the Python-bugs-list mailing list