By the way, just to finish playing this new fun game "Who'd I Borrow This Reference From?": On 10/10/2016 11:45 AM, Chris Angelico wrote: > On Mon, Oct 10, 2016 at 8:35 PM, Larry Hastings <larry at hastings.org> wrote: >> I bet for every other spot in the API I can tell you from >> whom you're borrowing the reference. > Okay. Here's a test: > > PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index) > Return value: Borrowed reference. > > Presumably you own a reference to the list itself before you call > this, and the list has a reference to its items. But suppose another > thread clear()s the list immediately after you call this; whose > reference are you borrowing now? The list's is gone. As you say: you've borrowed the reference from the list. With the GIL this is safe. After the Gilectomy it's not always safe. It *can* be: for example, if you allocated the list locally in the current thread, and it hasn't escaped the thread yet, you can assert that in this case reference will never go away on you. But in general this is an API that has to change for the Gilectomy. //arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20161011/138bd3d1/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4