commit | 4a22b5dee77b6a3439e4a09362586c390bbdef02 | [log] [tgz] |
---|---|---|
author | Christian Heimes <christian@cheimes.de> | Sun Nov 25 09:39:14 2007 +0000 |
committer | Christian Heimes <christian@cheimes.de> | Sun Nov 25 09:39:14 2007 +0000 |
tree | 670472c02e788fe4d027f7967fbbd8253e18cb5f | |
parent | 91c77301bf0246deabcdcd80bc7bedb169e2f964 [diff] [blame] |
Patch from Georg Brandl and me for #1493 Remove unbound method objects
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 408be4c..f9b0346 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c
@@ -643,8 +643,10 @@ 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); }