Kyle Smith added the comment:
Since you were able to help me scope that this is probably an MacOS specific
issue, I was able to find this report:
https://github.com/pytest-dev/pytest-flask/issues/104
Setting `multiprocessing.set_start_method("fork")` _BEFORE_ the code is called
resolves this
Kyle Smith added the comment:
Interesting. I did try between MacOS (12.2) and Ubuntu since I have servers
with older python versions. For scoping then, this appears to be related only
to MacOS since you were able to confirm it working correctly on Linux.
The code is the same, but here's the
Steven D'Aprano added the comment:
Works for me in Python 3.10.0 on Linux.
After running your code, I get shared_dict is a DictProxy:
>>> shared_dict
>>> list(shared_dict.items())
[('number', 0), ('text', 'Hello World')]
and shared_lock an AcquirerProxy object.
Please double-check that the
New submission from Kyle Smith :
The below code works on versions 3.5.2 to 3.8.10. Higher versions tested, such
as 3.9.12 and 3.10.2 result in the error:
"AttributeError: Can't pickle local object".
from multiprocessing import Lock
from multiprocessing.managers import AcquirerProxy, BaseMana