diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 7ebec547279b8ff0e1cc025163d0f836adff92d2..d3bee361bd8daf24f5785099c499a983295e49c8 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -2555,7 +2555,7 @@ class TransformBuiltinMethods(EnvTransform): node = ExprNodes.StringNode(node.pos, value=EncodedString(version)) elif attribute == u'NULL': node = ExprNodes.NullNode(node.pos) - elif attribute in (u'set', u'frozenset'): + elif attribute in (u'set', u'frozenset', u'staticmethod'): node = ExprNodes.NameNode(node.pos, name=EncodedString(attribute), entry=self.current_env().builtin_scope().lookup_here(attribute)) elif PyrexTypes.parse_basic_type(attribute): diff --git a/tests/run/staticmethod.pyx b/tests/run/staticmethod.pyx index c3d6b74340725966f2ba57aee6214a64c06026d2..cec047601f60e86998e7e8419792e6b725e1a250 100644 --- a/tests/run/staticmethod.pyx +++ b/tests/run/staticmethod.pyx @@ -120,3 +120,12 @@ cdef class ArgsKwargs(object): (1, 2, ('a', 3)) """ return args + tuple(sorted(kwargs.items())) + +class StaticmethodSubclass(staticmethod): + """ + >>> s = StaticmethodSubclass(None) + >>> s.is_subtype() + True + """ + def is_subtype(self): + return isinstance(self, staticmethod)