Commit c79d2aa8 authored by Robert Bradshaw's avatar Robert Bradshaw

Allow staticmethod in non-decorator contexts.

parent 0c23fb81
...@@ -2555,7 +2555,7 @@ class TransformBuiltinMethods(EnvTransform): ...@@ -2555,7 +2555,7 @@ class TransformBuiltinMethods(EnvTransform):
node = ExprNodes.StringNode(node.pos, value=EncodedString(version)) node = ExprNodes.StringNode(node.pos, value=EncodedString(version))
elif attribute == u'NULL': elif attribute == u'NULL':
node = ExprNodes.NullNode(node.pos) 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), node = ExprNodes.NameNode(node.pos, name=EncodedString(attribute),
entry=self.current_env().builtin_scope().lookup_here(attribute)) entry=self.current_env().builtin_scope().lookup_here(attribute))
elif PyrexTypes.parse_basic_type(attribute): elif PyrexTypes.parse_basic_type(attribute):
......
...@@ -120,3 +120,12 @@ cdef class ArgsKwargs(object): ...@@ -120,3 +120,12 @@ cdef class ArgsKwargs(object):
(1, 2, ('a', 3)) (1, 2, ('a', 3))
""" """
return args + tuple(sorted(kwargs.items())) return args + tuple(sorted(kwargs.items()))
class StaticmethodSubclass(staticmethod):
"""
>>> s = StaticmethodSubclass(None)
>>> s.is_subtype()
True
"""
def is_subtype(self):
return isinstance(self, staticmethod)
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