diff options
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 408be4c064..f9b0346eaa 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -643,8 +643,10 @@ function_call(PyObject *func, PyObject *arg, PyObject *kw) static PyObject * func_descr_get(PyObject *func, PyObject *obj, PyObject *type) { - if (obj == Py_None) - obj = NULL; + if (obj == Py_None || obj == NULL) { + Py_INCREF(func); + return func; + } return PyMethod_New(func, obj, type); } |