[issue3095] multiprocessing initializes flags dict unsafely

2008-06-13 Thread Adam Olsen
Adam Olsen <[EMAIL PROTECTED]> added the comment: Aww, that's cheating. (Why didn't I think of that?) ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue3095] multiprocessing initializes flags dict unsafely

2008-06-12 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: I think the easiest way is to just call AddObject after inserting the values. I fixed this, and the leaking BuildValue references, in r64223. -- nosy: +georg.brandl resolution: -> fixed status: open -> closed

[issue3095] multiprocessing initializes flags dict unsafely

2008-06-12 Thread Adam Olsen
Adam Olsen <[EMAIL PROTECTED]> added the comment: This doesn't look right. PyDict_SetItemString doesn't steal the references passed to it, so your reference to flags will be leaked each time. Besides, I think it's a little cleaner to INCREF it before call PyModule_AddObject, then DECREF it at a

[issue3095] multiprocessing initializes flags dict unsafely

2008-06-12 Thread James Thomas
James Thomas <[EMAIL PROTECTED]> added the comment: I believe this patch solves the problem. I added the line Py_DECREF(temp) after the code block shown above. I also changed the line if (PyDict_SetItemString(temp, #name, Py_BuildValue("i", name)) < 0) return to if (PyDict_SetItemString(PyObjec

[issue3095] multiprocessing initializes flags dict unsafely

2008-06-12 Thread Jesse Noller
Changes by Jesse Noller <[EMAIL PROTECTED]>: -- nosy: +jnoller, roudkerk ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list

[issue3095] multiprocessing initializes flags dict unsafely

2008-06-12 Thread Adam Olsen
New submission from Adam Olsen <[EMAIL PROTECTED]>: multiprocessing.c currently has code like this: temp = PyDict_New(); if (!temp) return; if (PyModule_AddObject(module, "flags", temp) < 0) return; PyModule_AddObject consumes the referenc