mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF 1055820: weakref callback vs gc vs threads
In cyclic gc, clear weakrefs to unreachable objects before allowing any Python code (weakref callbacks or __del__ methods) to run. This is a critical bugfix, affecting all versions of Python since weakrefs were introduced. I'll backport to 2.3.
This commit is contained in:
parent
d7bcf4deb1
commit
ead8b7ab30
6 changed files with 531 additions and 110 deletions
|
@ -850,7 +850,9 @@ PyWeakref_GetObject(PyObject *ref)
|
|||
return PyWeakref_GET_OBJECT(ref);
|
||||
}
|
||||
|
||||
|
||||
/* Note that there's an inlined copy-paste of handle_callback() in gcmodule.c's
|
||||
* handle_weakrefs().
|
||||
*/
|
||||
static void
|
||||
handle_callback(PyWeakReference *ref, PyObject *callback)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue