Terrence Cole <[email protected]> added the comment:
Kaushik, in your example, d is a dict proxy, so assignment to d['f'] correctly
ferries the assignment (a new normal dict) to the d['f'] in the original
process. The new dict, however, is not a dict proxy, it's just a dict, so
assignment of d['f']['msg'] goes nowhere. All hope is not lost, however,
because the Manager can be forked to new processes. The slightly modified
example below shows how this works:
from multiprocessing import Process, Manager
def f(m, d):
d['f'] = m.dict()
d['f']['msg'] = 'I am here'
m = Manager()
d = m.dict()
p = Process(target=f, args=(m,d))
p.start()
p.join()
print d
{'f': <DictProxy object, typeid 'dict' at 0x7f1517902810>}
print d['f']
{'msg': 'I am here'}
With the attached patch, the above works as shown, without, it gives the same
output as your original example.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6766>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com