return self._handle_decorators(
func_node, func_node.name)
- def _visit_CClassDefNode(self, class_node):
- # This doesn't currently work, so it's disabled (also in the
- # parser).
+ def visit_CClassDefNode(self, class_node):
+ # This doesn't currently work, so it's disabled.
#
# Problem: assignments to cdef class names do not work. They
# would require an additional check anyway, as the extension
self.visitchildren(class_node)
if not class_node.decorators:
return class_node
- return self._handle_decorators(
- class_node, class_node.class_name)
+ error(class_node.pos,
+ "Decorators not allowed on cdef classes (used on type '%s')" % class_node.class_name)
+ return class_node
+ #return self._handle_decorators(
+ # class_node, class_node.class_name)
def visit_ClassDefNode(self, class_node):
self.visitchildren(class_node)
s.level = ctx.level
node = p_cdef_statement(s, ctx(overridable = overridable))
if decorators is not None:
- if not isinstance(node, (Nodes.CFuncDefNode, Nodes.CVarDefNode)):
- s.error("Decorators can only be followed by functions or Python classes")
+ if not isinstance(node, (Nodes.CFuncDefNode, Nodes.CVarDefNode, Nodes.CClassDefNode)):
+ s.error("Decorators can only be followed by functions or classes")
node.decorators = decorators
return node
else: