[Python-Dev] PyWeakref_GetObject() borrows its reference from... whom? (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Oct 10 18:44:55 EDT 2016


Random832 wrote:

Or is this a special kind of lock that you can "assert isn't locked" without locking it for yourself, and INCREF/DECREF does so?

I don't think that would work. It might be unlocked at the moment you test it, but someone might lock it between then and the following INCREF/DECREF.

Locking is like pregnancy -- you can't have just a little bit of it. :-)

-- Greg



More information about the Python-Dev mailing list