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

Paul Moore p.f.moore at gmail.com
Mon Oct 10 13:03:45 EDT 2016


On 10 October 2016 at 17:49, MRAB <python at mrabarnett.plus.com> wrote:
> If you lookup something in a dict, it'll be a borrowed reference.
>
> If the dict is globals() and there's no GIL, another thread could delete the
> item while your code had the borrowed reference.
>
> It looks like there might be a lot that will need to changed post gilectomy!

It seems to me that the whole concept of a borrowed reference may be
risky in a post-GIL world. There may be occasional cases where it's
possible to prove that borrowing is safe, but I suspect they'll be
pretty rare.

Paul


More information about the Python-Dev mailing list