mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119)
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
729b6747e9
commit
3267847759
32 changed files with 77 additions and 83 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "pycore_ceval.h" // _PyEval_GetBuiltin()
|
||||
#include "pycore_modsupport.h" // _PyArg_NoKeywords()
|
||||
#include "pycore_moduleobject.h" // _PyModule_GetState()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
|
||||
#include <stddef.h> // offsetof()
|
||||
#include <stdbool.h>
|
||||
|
@ -728,9 +729,7 @@ array_dealloc(PyObject *op)
|
|||
PyObject_GC_UnTrack(op);
|
||||
|
||||
arrayobject *self = arrayobject_CAST(op);
|
||||
if (self->weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs(op);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS(op, self->weakreflist);
|
||||
if (self->ob_item != NULL) {
|
||||
PyMem_Free(self->ob_item);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue