[Python-Dev] PyWeakref_GetObject() borrows its reference from... whom? (original) (raw)
Larry Hastings larry at hastings.org
Mon Oct 10 04:17:33 EDT 2016
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The documentation for PyWeakref_GetObject() states:
Return value: Borrowed reference.
Return the referenced object from a weak reference, ref. If the
referent is no longer live, returns Py_None.
Given that the weakref doesn't have a reference to the object--merely a weak reference, different thing--whose reference is it borrowing?
FWIW, yes, this is playing merry hell with the Gilectomy. If there are
two threads, and one calls PyWeakref_GetObject(obj), and there's only
one reference to obj, and the other thread blows it away... now what?
It's my contention that this API is simply untenable under the
Gilectomy, and that it needs to change to returning a new (strong)
reference.
//arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20161010/f96b2ce1/attachment.html>
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]