Commit 47ca6aaa authored by Robert Bradshaw's avatar Robert Bradshaw

Make decorators on special functions an error. Trac #649.

parent 65909098
...@@ -2056,7 +2056,7 @@ class DefNode(FuncDefNode): ...@@ -2056,7 +2056,7 @@ class DefNode(FuncDefNode):
def analyse_signature(self, env): def analyse_signature(self, env):
if self.entry.is_special: if self.entry.is_special:
if self.decorators: if self.decorators:
warning(self.pos, "special functions of cdef classes cannot have decorators", 1) error(self.pos, "special functions of cdef classes cannot have decorators")
self.entry.trivial_signature = len(self.args) == 1 and not (self.star_arg or self.starstar_arg) self.entry.trivial_signature = len(self.args) == 1 and not (self.star_arg or self.starstar_arg)
elif not env.directives['always_allow_keywords'] and not (self.star_arg or self.starstar_arg): elif not env.directives['always_allow_keywords'] and not (self.star_arg or self.starstar_arg):
# Use the simpler calling signature for zero- and one-argument functions. # Use the simpler calling signature for zero- and one-argument functions.
......
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