robertwb / issues-import-test

0 stars 0 forks source link

Combining @staticmethod with other decorators is broken #113

Open robertwb opened 7 years ago

robertwb commented 7 years ago

Reported by jdemeyer on 12 May 2016 13:58 UTC Consider

def debug(fun):
    print(fun)
    return fun

class A(object):
    @staticmethod
    @debug
    def foo(self):
        return self

In Python, this correctly prints <function foo at 0x7f4d305df410>. In Cython, this wrongly prints <staticmethod object at 0x7f4d30e5e718>.

When doing the same with a Cython cdef class, the decorators are somehow applied twice: the output becomes

<staticmethod object at 0x7f4d30e5eb40>
<staticmethod object at 0x7f4d305e52f0>

Migrated-From: http://trac.cython.org/ticket/880