Armin Rigo added the comment: PyWeakref_GET_OBJECT() is inherently dangerous: the weakref might go away not only the next time the GIL is released, but also the next time the code does any seemingly unrelated Py_DECREF() (which might decref the object into inexistence) or memory allocation (which might trigger the GC).
I'd suggest adding the comment above in the docs and reviewing all usages inside CPython's code base. ---------- nosy: +arigo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25769> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com