> On 21 Oct 2020, at 14:39, Larry Hastings <la...@hastings.org> wrote: > > On 10/21/20 4:04 AM, Antoine Pitrou wrote: >> (apart from small fixes relating to borrowed references, and >> that's mostly to make PyPy's life easier). > > Speaking as the Gilectomy guy: borrowed references are evil. The definition > of the valid lifetime of a borrowed reference doesn't exist, because they are > a hack (baked into the API!) that we mostly "get away with" just because of > the GIL. If I still had wishes left on my monkey's paw I'd wish them away*. > > Even with the GIL borrowed references are problematic. There are a lot of cases where using a borrowed reference after calling an API that might run Python code might invalidate the borrowed reference. In general the only safe thing to do with a borrowed reference is to turn it into a strong reference as soon as possible.
Ronald — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ > > /arry > > * Unfortunately, I used my last wish back in February, wishing I could spend > more time at home. > > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/PRIVTI2RFGEGVNQRGUCHRRY5WBJNZKJS/ > Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PV3DSRZVS4JLYTGU5Z6JPBKDZT4X4QY5/ Code of Conduct: http://python.org/psf/codeofconduct/