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
|
@ -11,6 +11,7 @@
|
|||
#include "pycore_bytesobject.h" // _PyBytesWriter
|
||||
#include "pycore_long.h" // _PyLong_AsByteArray()
|
||||
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
|
||||
#include <stddef.h> // offsetof()
|
||||
|
||||
|
@ -1794,9 +1795,7 @@ s_dealloc(PyObject *op)
|
|||
PyStructObject *s = PyStructObject_CAST(op);
|
||||
PyTypeObject *tp = Py_TYPE(s);
|
||||
PyObject_GC_UnTrack(s);
|
||||
if (s->weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs(op);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS(op, s->weakreflist);
|
||||
if (s->s_codes != NULL) {
|
||||
PyMem_Free(s->s_codes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue