cython-devel

changeset 1889:c22c5f879f26

Warning, not error, on builting type redeclaration.

Throwing an error is to invasive for 0.11.x, and also one needs to be able to subclass/access attributes of builtin types before we get rid of the declaration altogether.
author Robert Bradshaw <robertwb@math.washington.edu>
date Wed Mar 25 15:54:27 2009 -0700 (2 years ago)
parents 52b9ed726ad5
children 2289ab00261d36698f878c79
files Cython/Compiler/Nodes.py tests/errors/builtin_type_conflict_T170.pyx
line diff
1.1 --- a/Cython/Compiler/Nodes.py Wed Mar 25 15:46:35 2009 -0700 1.2 +++ b/Cython/Compiler/Nodes.py Wed Mar 25 15:54:27 2009 -0700 1.3 @@ -2679,8 +2679,7 @@ 1.4 1.5 if self.visibility == 'extern': 1.6 if self.module_name == '__builtin__' and self.class_name in Builtin.builtin_types: 1.7 - error(self.pos, "%s already a builtin Cython type" % self.class_name) 1.8 - return 1.9 + warning(self.pos, "%s already a builtin Cython type" % self.class_name, 1) 1.10 1.11 self.entry = home_scope.declare_c_class( 1.12 name = self.class_name,
2.1 --- a/tests/errors/builtin_type_conflict_T170.pyx Wed Mar 25 15:46:35 2009 -0700 2.2 +++ b/tests/errors/builtin_type_conflict_T170.pyx Wed Mar 25 15:54:27 2009 -0700 2.3 @@ -3,6 +3,13 @@ 2.4 pass 2.5 2.6 cdef list foo = [] 2.7 -_ERRORS = u""" 2.8 + 2.9 +# This is too invasive for Python 0.11.x, re-enable in 0.12 2.10 +NEW_ERRORS = u""" 2.11 :2:4: list already a builtin Cython type 2.12 """ 2.13 + 2.14 +_ERRORS = u""" 2.15 +:5:16: Cannot coerce list to type 'list' 2.16 +""" 2.17 +