summaryrefslogtreecommitdiff
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2018-02-13 12:28:33 +0200
committerINADA Naoki <methane@users.noreply.github.com>2018-02-13 19:28:33 +0900
commitd019bc8319ea35e93bf4baa38098ff1b57cd3ee5 (patch)
treed9b927eba02059f8be8465d35b6969254b172b8e /Objects/funcobject.c
parentaec7532ed3ccbd29d3429a3f375e25f956c44003 (diff)
downloadcpython-git-d019bc8319ea35e93bf4baa38098ff1b57cd3ee5.tar.gz
bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index d376f9cab9..241685d5b7 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -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;
}