mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
@ -31,6 +31,7 @@
|
|||
#include "util.h"
|
||||
|
||||
#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
|
||||
typedef enum {
|
||||
TYPE_LONG,
|
||||
|
@ -185,9 +186,7 @@ cursor_dealloc(PyObject *op)
|
|||
pysqlite_Cursor *self = _pysqlite_Cursor_CAST(op);
|
||||
PyTypeObject *tp = Py_TYPE(self);
|
||||
PyObject_GC_UnTrack(self);
|
||||
if (self->in_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs(op);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS(op, self->in_weakreflist);
|
||||
(void)tp->tp_clear(op);
|
||||
tp->tp_free(self);
|
||||
Py_DECREF(tp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue