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:
Xuanteng Huang 2025-06-30 19:14:31 +08:00 committed by GitHub
parent 0533c1faf2
commit b1056c2a44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 77 additions and 83 deletions

View file

@ -4,6 +4,7 @@
#include "blob.h"
#include "util.h"
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
#define clinic_state() (pysqlite_get_state_by_type(Py_TYPE(self)))
#include "clinic/blob.c.h"
@ -56,9 +57,7 @@ blob_dealloc(PyObject *op)
close_blob(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);