mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614)
Co-authored-by: Kumar Aditya <kumaraditya@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
0533c1faf2
commit
b1056c2a44
32 changed files with 77 additions and 83 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_InternImmortal()
|
||||
#include "pycore_uniqueid.h" // _PyObject_AssignUniqueId()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
|
||||
#include "clinic/codeobject.c.h"
|
||||
#include <stdbool.h>
|
||||
|
@ -2436,9 +2437,7 @@ code_dealloc(PyObject *self)
|
|||
Py_XDECREF(co->_co_cached->_co_varnames);
|
||||
PyMem_Free(co->_co_cached);
|
||||
}
|
||||
if (co->co_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs(self);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS(self, co->co_weakreflist);
|
||||
free_monitoring_data(co->_co_monitoring);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
// The first element always points to the mutable bytecode at the end of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue