diff options
author | Jeroen Demeyer <jdemeyer@cage.ugent.be> | 2017-06-02 15:23:17 +0200 |
---|---|---|
committer | Jeroen Demeyer <jdemeyer@cage.ugent.be> | 2017-06-02 17:20:26 +0200 |
commit | 99e40cd2a75c74ea5ccabcedc9c5e794a84be487 (patch) | |
tree | 01f05d49f62aec3ee91fa8e858df66cd4e6580f7 /Cython/Compiler/ParseTreeTransforms.py | |
parent | b2dc5c222b3a4e6e11f6c7596890fd5406e2d086 (diff) | |
download | cython-99e40cd2a75c74ea5ccabcedc9c5e794a84be487.tar.gz |
Do not apply decorators twice
This fixes https://github.com/cython/cython/issues/1679
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r-- | Cython/Compiler/ParseTreeTransforms.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index d5159234a..4fc0d9857 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1336,8 +1336,18 @@ class DecoratorTransform(ScopeTrackingTransform, SkipDeclarations): return self._reject_decorated_property(node, decorator_node) return self._add_to_property(properties, node, handler_name, decorator_node) + # we clear node.decorators, so we need to set the + # is_staticmethod/is_classmethod attributes now + for decorator in node.decorators: + func = decorator.decorator + if func.is_name: + node.is_classmethod |= func.name == 'classmethod' + node.is_staticmethod |= func.name == 'staticmethod' + # transform normal decorators - return self.chain_decorators(node, node.decorators, node.name) + decs = node.decorators + node.decorators = None + return self.chain_decorators(node, decs, node.name) @staticmethod def _reject_decorated_property(node, decorator_node): |