mirror of
https://github.com/python/cpython.git
synced 2026-02-13 19:04:37 +00:00
[3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126)
gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614)
(cherry picked from commit b1056c2a44)
Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
1e3466a1ae
commit
e3a277c8d8
31 changed files with 75 additions and 73 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_setobject.h" // _PySet_NextEntry()
|
||||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
#include "clinic/codeobject.c.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
|
@ -1927,9 +1928,7 @@ code_dealloc(PyCodeObject *co)
|
|||
Py_XDECREF(co->_co_cached->_co_varnames);
|
||||
PyMem_Free(co->_co_cached);
|
||||
}
|
||||
if (co->co_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject*)co);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS((PyObject*)co, co->co_weakreflist);
|
||||
free_monitoring_data(co->_co_monitoring);
|
||||
PyObject_Free(co);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue