Commit e3c9a786 authored by Robert Bradshaw's avatar Robert Bradshaw

Make __new__ -> __cinit__ into an error, fix compiler crash.

parent 1fb5c964
...@@ -1988,7 +1988,7 @@ class DefNode(FuncDefNode): ...@@ -1988,7 +1988,7 @@ class DefNode(FuncDefNode):
# staticmethod() was overridden - not much we can do here ... # staticmethod() was overridden - not much we can do here ...
self.is_staticmethod = False self.is_staticmethod = False
if self.name == '__new__': if self.name == '__new__' and env.is_py_class_scope:
self.is_staticmethod = 1 self.is_staticmethod = 1
self.analyse_argument_types(env) self.analyse_argument_types(env)
......
...@@ -1561,9 +1561,8 @@ class CClassScope(ClassScope): ...@@ -1561,9 +1561,8 @@ class CClassScope(ClassScope):
if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'): if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'):
error(pos, "Special method %s must be implemented via __richcmp__" % name) error(pos, "Special method %s must be implemented via __richcmp__" % name)
if name == "__new__": 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.") "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') entry = self.declare_var(name, py_object_type, pos, visibility='extern')
special_sig = get_special_method_signature(name) special_sig = get_special_method_signature(name)
if special_sig: if special_sig:
......
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