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
|
@ -1,6 +1,7 @@
|
|||
#include "Python.h"
|
||||
#include <stddef.h> // offsetof()
|
||||
#include "pycore_object.h"
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
#include "_iomodule.h"
|
||||
|
||||
/* Implementation note: the buffer is always at least one character longer
|
||||
|
@ -638,9 +639,7 @@ stringio_dealloc(PyObject *op)
|
|||
}
|
||||
PyUnicodeWriter_Discard(self->writer);
|
||||
(void)stringio_clear(op);
|
||||
if (self->weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs(op);
|
||||
}
|
||||
FT_CLEAR_WEAKREFS(op, self->weakreflist);
|
||||
tp->tp_free(self);
|
||||
Py_DECREF(tp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue