cython-devel
changeset 4256:b816b03ff502 tip
Make __new__ -> __cinit__ into an error, fix compiler crash.
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Tue Dec 21 02:09:22 2010 -0800 (13 months ago) |
| parents | ac9b34088fb1 |
| children | |
| files | Cython/Compiler/Nodes.py Cython/Compiler/Symtab.py |
line diff
1.1 --- a/Cython/Compiler/Nodes.py Tue Dec 21 01:45:27 2010 -0800
1.2 +++ b/Cython/Compiler/Nodes.py Tue Dec 21 02:09:22 2010 -0800
1.3 @@ -1988,7 +1988,7 @@
1.4 # staticmethod() was overridden - not much we can do here ...
1.5 self.is_staticmethod = False
1.6
1.7 - if self.name == '__new__':
1.8 + if self.name == '__new__' and env.is_py_class_scope:
1.9 self.is_staticmethod = 1
1.10
1.11 self.analyse_argument_types(env)
2.1 --- a/Cython/Compiler/Symtab.py Tue Dec 21 01:45:27 2010 -0800
2.2 +++ b/Cython/Compiler/Symtab.py Tue Dec 21 02:09:22 2010 -0800
2.3 @@ -1561,9 +1561,8 @@
2.4 if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'):
2.5 error(pos, "Special method %s must be implemented via __richcmp__" % name)
2.6 if name == "__new__":
2.7 - warning(pos, "__new__ method of extension type will change semantics "
2.8 + error(pos, "__new__ method of extension type will change semantics "
2.9 "in a future version of Pyrex and Cython. Use __cinit__ instead.")
2.10 - name = EncodedString("__cinit__")
2.11 entry = self.declare_var(name, py_object_type, pos, visibility='extern')
2.12 special_sig = get_special_method_signature(name)
2.13 if special_sig:
