From 90a46cc8944e41a05d18129c8fde4fd6542efc5e Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 5 Sep 2008 12:08:42 +0200 Subject: [PATCH] fix for #59: compiler crash when special signatures where declared with cdef --- Cython/Compiler/ModuleNode.py | 2 +- tests/errors/cdefspecial.pyx | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/errors/cdefspecial.pyx 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' +""" -- 2.26.2