Commit 66773260 authored by Jeroen Demeyer's avatar Jeroen Demeyer Committed by Stefan Behnel

Always bind Cython functions

parent caa52f6f
...@@ -548,21 +548,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, ...@@ -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) 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); return __Pyx_PyMethod_New(func, obj, type);
} }
......
...@@ -376,6 +376,18 @@ class TestUnboundMethod: ...@@ -376,6 +376,18 @@ class TestUnboundMethod:
def meth(self): pass 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: cdef class TestOptimisedBuiltinMethod:
""" """
>>> obj = TestOptimisedBuiltinMethod() >>> obj = TestOptimisedBuiltinMethod()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment