@staticmethod decorator applied twice
When investigating some issue with decorators, I noticed the following stange thing: it seems that the @staticmethod decorator is actually applied twice in some cases. For example, the testsuite file tests/run/static_methods.pyx contains the following code: cdef class A: @staticmethod def static_def(int x): ... The relevant part of the Cython-generated code: __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_14static_methods_1A_1static_def, NULL, __pyx_n_s_static_methods); ... PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); ... if (PyDict_SetItem((PyObject *)__pyx_ptype_14static_methods_A->tp_dict, __pyx_n_s_static_def, __pyx_t_1) < 0) ... __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_14static_methods_A, __pyx_n_s_static_def); ... PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_staticmethod, __pyx_t_2, NULL); ... if (PyDict_SetItem((PyObject *)__pyx_ptype_14static_methods_A->tp_dict, __pyx_n_s_static_def, __pyx_t_1) < 0) I might be missing something, but this really looks like Cython is applying the @staticmethod decorator twice.
I created http://trac.cython.org/ticket/880 for some issues regarding @staticmethod
participants (1)
-
Jeroen Demeyer