From: Stefan Behnel Date: Fri, 5 Sep 2008 10:08:42 +0000 (+0200) Subject: fix for #59: compiler crash when special signatures where declared with cdef X-Git-Tag: 0.9.9.2.beta~95^2~9^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=90a46cc8944e41a05d18129c8fde4fd6542efc5e;p=cython.git fix for #59: compiler crash when special signatures where declared with cdef --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 6beaa6fa..6d3100eb 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -872,7 +872,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): else: code.put_init_var_to_py_none(entry, "p->%s") entry = scope.lookup_here("__new__") - if entry: + if entry and entry.is_special: if entry.trivial_signature: cinit_args = "o, %s, NULL" % Naming.empty_tuple else: diff --git a/tests/errors/cdefspecial.pyx b/tests/errors/cdefspecial.pyx new file mode 100644 index 00000000..53a484ea --- /dev/null +++ b/tests/errors/cdefspecial.pyx @@ -0,0 +1,12 @@ + +cdef class Test: + cdef __cinit__(self): + pass + + cdef __len__(self): + pass + +_ERRORS = u""" +3:9: Special methods must be declared with 'def', not 'cdef' +6:9: Special methods must be declared with 'def', not 'cdef' +"""