Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

"Martin v. Löwis" martin at v.loewis.de
Wed Nov 8 00:10:14 EST 2006


Ross Ridge schrieb:
> So give an example where reference counting is unsafe.

Nobody claimed that, in that thread. Instead, the claim was
"Atomic increment and decrement instructions are not by themselves
sufficient to make reference counting safe."

I did give an example, in <4550cc64$0$3462$9b622d9e at news.freenet.de>.
Even though f_name is reference-counted, it might happen that you get a
dangling pointer. More specifically, even if file_repr *incremented* the
reference counter for f_name, it might still be a dangling pointer.

To quote Joe again:

# Basically there's a race condition where an object containing the
# refcount can be deleted between the time you load a pointer to
# the object and the time you increment what used to be a refcount
# and is possibly something else but definitely undefined.

I don't understand why you can't see that this statement is factually
correct.

Regards,
Martin



More information about the Python-list mailing list