summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Demeyer <jeroen.k.demeyer@gmail.com>2019-08-28 10:56:28 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-06-14 11:21:52 +0200
commit6677326025dcd3acfd4e1e2beabdc678c53dec19 (patch)
treedb2f9528f43498a8fc09d5e6123b8a8dcd180e2f
parentcaa52f6f018caf1da1bd964640f953cb30516b3d (diff)
downloadcython-6677326025dcd3acfd4e1e2beabdc678c53dec19.tar.gz
Always bind Cython functions
-rw-r--r--Cython/Utility/CythonFunction.c15
-rw-r--r--tests/run/cyfunction.pyx12
2 files changed, 12 insertions, 15 deletions
diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c
index a65c8eee3..edf549127 100644
--- a/Cython/Utility/CythonFunction.c
+++ b/Cython/Utility/CythonFunction.c
@@ -548,21 +548,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
- __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
-
- if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
- Py_INCREF(func);
- return func;
- }
-
- if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
- if (type == NULL)
- type = (PyObject *)(Py_TYPE(obj));
- return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
- }
-
- if (obj == Py_None)
- obj = NULL;
return __Pyx_PyMethod_New(func, obj, type);
}
diff --git a/tests/run/cyfunction.pyx b/tests/run/cyfunction.pyx
index 3811b2694..4451436ce 100644
--- a/tests/run/cyfunction.pyx
+++ b/tests/run/cyfunction.pyx
@@ -376,6 +376,18 @@ class TestUnboundMethod:
def meth(self): pass
+class TestStaticmethod(object):
+ """
+ >>> x = TestStaticmethod()
+ >>> x.staticmeth(42)
+ 42
+ >>> x.staticmeth.__get__(42)()
+ 42
+ """
+ @staticmethod
+ def staticmeth(arg): return arg
+
+
cdef class TestOptimisedBuiltinMethod:
"""
>>> obj = TestOptimisedBuiltinMethod()