Make __new__ -> __cinit__ into an error, fix compiler crash.
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 21 Dec 2010 10:09:22 +0000 (02:09 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 21 Dec 2010 10:09:22 +0000 (02:09 -0800)
Cython/Compiler/Nodes.py
Cython/Compiler/Symtab.py

index ff130a487d178785f7fd4e0acf850434eb58ae1f..4a0b65bbada1bae04d8c1319ba850624ce64a5ee 100644 (file)
@@ -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)
index c868349903cd79836129386050ed4feb50fad005..536cb72e441d8cb99df1af47de6d945987e37956 100644 (file)
@@ -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: