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

2016年10月10日 01:20:44 -0700

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/
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to