summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-25 09:39:14 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-25 09:39:14 (GMT)
commit4a22b5dee77b6a3439e4a09362586c390bbdef02 (patch)
tree670472c02e788fe4d027f7967fbbd8253e18cb5f /Objects/funcobject.c
parent91c77301bf0246deabcdcd80bc7bedb169e2f964 (diff)
downloadcpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.zip
cpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.tar.gz
cpython-4a22b5dee77b6a3439e4a09362586c390bbdef02.tar.bz2
Patch from Georg Brandl and me for #1493
Remove unbound method objects
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c6
1 files changed, 4 insertions, 2 deletions
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 @@ 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);
}