From c9b0953bda1339137a7280ab1b1085abbdf4977a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 25 May 2008 09:24:38 +0000 Subject: #2964: fix missing INCREF. --- Misc/NEWS | 2 ++ Objects/classobject.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index f385560..08bd092 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's new in Python 3.0b1? Core and Builtins ----------------- +- Issue #2964: fix a missing INCREF in instancemethod_descr_get. + - Issue 2895: Don't crash when given bytes objects as keyword names. - Issue 2798: When parsing arguments with PyArg_ParseTuple, the "s" code now diff --git a/Objects/classobject.c b/Objects/classobject.c index 0e131eb..3c2bc3d 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -501,8 +501,10 @@ instancemethod_call(PyObject *self, PyObject *arg, PyObject *kw) static PyObject * instancemethod_descr_get(PyObject *descr, PyObject *obj, PyObject *type) { register PyObject *func = PyInstanceMethod_GET_FUNCTION(descr); - if (obj == NULL) + if (obj == NULL) { + Py_INCREF(func); return func; + } else return PyMethod_New(func, obj); } -- cgit v0.12