New submission from Andrei Stefan <[email protected]>:
I'm creating a shared dict for multiprocessing purposes:
from multiprocessing import Manager
manager = Manager()
shared_dict = manager.dict()
If I add a set or a list as a value in the dict:
shared_dict['test'] = set() or shared_dict['test'] = list()
I can't add/append in that set/list inside the shared dictionary:
shared_dict['test'].add(1234) or shared_dict['test'].append(1234)
The following expression:
print(dict(shared_dict))
Will return:
{'test': set()} or {'test': []}.
But if I add in the set/list using operators:
shared_dict['test'] |= {1234} or shared_dict['test'] += [1234]
It will work:
{'test': {1234}} or {'test': [1234]}.
----------
components: Build
files: image (2).png
messages: 336642
nosy: andrei2peu
priority: normal
severity: normal
status: open
title: Can't add/append in set/list inside shared dict
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48171/image (2).png
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36119>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com