mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -7,6 +7,7 @@
|
|||
#include "pycore_object.h"
|
||||
#include "pycore_pyerrors.h"
|
||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
|
||||
|
||||
|
||||
#include "clinic/classobject.c.h"
|
||||
|
@ -245,8 +246,7 @@ method_dealloc(PyObject *self)
|
|||
{
|
||||
PyMethodObject *im = _PyMethodObject_CAST(self);
|
||||
_PyObject_GC_UNTRACK(im);
|
||||
if (im->im_weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *)im);
|
||||
FT_CLEAR_WEAKREFS(self, im->im_weakreflist);
|
||||
Py_DECREF(im->im_func);
|
||||
Py_XDECREF(im->im_self);
|
||||
assert(Py_IS_TYPE(self, &PyMethod_Type));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue