From e3c9a78686b7a7f0d36da8e6189b1e1fb4037c73 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 21 Dec 2010 02:09:22 -0800 Subject: [PATCH] Make __new__ -> __cinit__ into an error, fix compiler crash. --- Cython/Compiler/Nodes.py | 2 +- Cython/Compiler/Symtab.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index ff130a48..4a0b65bb 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1988,7 +1988,7 @@ class DefNode(FuncDefNode): # staticmethod() was overridden - not much we can do here ... self.is_staticmethod = False - if self.name == '__new__': + if self.name == '__new__' and env.is_py_class_scope: self.is_staticmethod = 1 self.analyse_argument_types(env) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index c8683499..536cb72e 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -1561,9 +1561,8 @@ class CClassScope(ClassScope): if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'): error(pos, "Special method %s must be implemented via __richcmp__" % name) if name == "__new__": - warning(pos, "__new__ method of extension type will change semantics " + error(pos, "__new__ method of extension type will change semantics " "in a future version of Pyrex and Cython. Use __cinit__ instead.") - name = EncodedString("__cinit__") entry = self.declare_var(name, py_object_type, pos, visibility='extern') special_sig = get_special_method_signature(name) if special_sig: -- 2.26.2