mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)
This commit is contained in:
parent
aec7532ed3
commit
d019bc8319
13 changed files with 105 additions and 19 deletions
|
@ -709,7 +709,7 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
Py_INCREF(callable);
|
||||
cm->cm_callable = callable;
|
||||
Py_XSETREF(cm->cm_callable, callable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -890,7 +890,7 @@ sm_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable))
|
||||
return -1;
|
||||
Py_INCREF(callable);
|
||||
sm->sm_callable = callable;
|
||||
Py_XSETREF(sm->sm_callable, callable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue