[Python-Dev] Fwd: Re: PyWeakref_GetObject() borrows its reference from... whom?

Larry Hastings larry at hastings.org
Tue Oct 11 02:41:46 EDT 2016


Hit "Reply" instead of "Reply All" last night, oops.  Forwarding to the 
list for posterity's sakes.

/
/arry/

-------- Forwarded Message --------
Subject: 	Re: [Python-Dev] PyWeakref_GetObject() borrows its reference 
from... whom?
Date: 	Mon, 10 Oct 2016 23:01:10 +0200
From: 	Larry Hastings <larry at hastings.org>
To: 	Nathaniel Smith <njs at pobox.com>


On 10/10/2016 07:50 PM, Nathaniel Smith wrote:
> If we say that borrowing reference from a dict is one of the things
> that counts as mucking about with that dict, and thus requires you to
> hold the dict lock for as long as you hold the borrowed reference,
> then all should be well.

That's not how locking works in the Gilectomy right now.  If you call 
PyDict_GetItem(), it locks the dict at the beginning, then looks up the 
thingy, then releases the lock just before returning.  It's hard for me 
to imagine how the dict would magically know when it could drop the 
borrowed reference returned by PyDict_GetItem().


> I assume Larry is way ahead of us on this,

I would say "that's your first mistake!" but I bet you've made others.  
Anyway, tbh most of the time I feel awfully unqualified to work on the 
Gilectomy.


Fools rush in,


//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20161011/f68baa5d/attachment.html>


More information about the Python-Dev mailing list