diff options
author | mattip <matti.picus@gmail.com> | 2018-11-13 19:18:18 -0800 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2018-11-13 19:18:18 -0800 |
commit | 3b931f1010528609d8f35b521a8bb2042fedf382 (patch) | |
tree | 0ba6ffa5b65bfe68d9bc05987fdbdb380f2bcf29 | |
parent | bee7b699e9a5c928ecdd4ff9a23d6764211c1ed6 (diff) | |
download | cython-3b931f1010528609d8f35b521a8bb2042fedf382.tar.gz |
whoops, staticmethod is a valid cdef decorator
-rw-r--r-- | Cython/Compiler/Nodes.py | 7 | ||||
-rw-r--r-- | Cython/Compiler/ParseTreeTransforms.py | 1 | ||||
-rw-r--r-- | tests/run/ext_attr_getter.srctree | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index bbf0c9073..682547222 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2344,11 +2344,10 @@ class CFuncDefNode(FuncDefNode): for decorator in self.decorators: func = decorator.decorator if func.is_name: - if func.name == 'classmethod' or func.name == 'staticmethod': - error(self.pos, "Cannot handle these decorators yet") - if func.name == 'property': - # XXX DO SOMETHING HERE??? + if func.name in ('property', 'staticmethod'): pass + else: + error(self.pos, "Cannot handle %s decorators yet" % func.name) self.is_c_class_method = env.is_c_class_scope if self.directive_locals is None: diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 85deda5d1..ed28ddfed 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -2256,6 +2256,7 @@ class ReplacePropertyNode(CythonTransform): # done - remove the decorator node node.decorators.remove(decorator_node) return [node] + return [node] class FindInvalidUseOfFusedTypes(CythonTransform): diff --git a/tests/run/ext_attr_getter.srctree b/tests/run/ext_attr_getter.srctree index 2cfc30191..e295f091c 100644 --- a/tests/run/ext_attr_getter.srctree +++ b/tests/run/ext_attr_getter.srctree @@ -150,7 +150,7 @@ def sum(Foo f): cdef extern from "foo.h": ctypedef class foo_extension.Foo [object FooStructOpaque]: - @staticmethod + @classmethod cdef void field0(): print('in staticmethod of Foo') |