Skip to content

Combining @staticmethod with other decorators is broken #1434

@robertwb

Description

@robertwb

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions