Author terrence
Recipients carlosdf, jnoller, kghose, terrence
Date 2010-01-30.04:06:19
SpamBayes Score 3.40903e-05
Marked as misclassified No
Message-id <1264824382.31.0.719765089694.issue6766@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-01-30 04:06:22terrencesetrecipients: + terrence, jnoller, carlosdf, kghose
2010-01-30 04:06:22terrencesetmessageid: <1264824382.31.0.719765089694.issue6766@psf.upfronthosting.co.za>
2010-01-30 04:06:20terrencelinkissue6766 messages
2010-01-30 04:06:19terrencecreate