[issue25769] Crash due to using weakref referent without acquiring a strong reference

2021-09-07 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> proxy_contains (weakref.proxy) can access an object with 0 refcount ___ Python tracker ___

[issue25769] Crash due to using weakref referent without acquiring a strong reference

2020-11-06 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker ___ _

[issue25769] Crash due to using weakref referent without acquiring a strong reference

2015-11-30 Thread Armin Rigo
Armin Rigo added the comment: Actually, Py_DECREF() may also release the GIL by calling a Python __del__() method; it doesn't have to directly decref the exact object. -- ___ Python tracker ___

[issue25769] Crash due to using weakref referent without acquiring a strong reference

2015-11-30 Thread Armin Rigo
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 (wh

[issue25769] Crash due to using weakref referent without acquiring a strong reference

2015-11-29 Thread lplatypus
lplatypus added the comment: I think the fix for this is simply a matter of using Py_INCREF/Py_DECREF around usage of the referent. This should only be necessary for nontrivial usages where the GIL might be released. Here is a patch. -- keywords: +patch Added file: http://bugs.python

[issue25769] Crash due to using weakref referent without acquiring a strong reference

2015-11-29 Thread lplatypus
New submission from lplatypus: I have encountered some crashes in a multithreaded application which appear to be due to a bug in weakref_richcompare in Objects/weakref.c (I am using Python 2.7.9, but the same weakref code exists in 3.5 and hg default branch too) weakref_richcompare ends with