From e1881e057eb51c9bbbc5c69c9af900ab3493b75e Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 25 Mar 2009 15:54:27 -0700 Subject: [PATCH] 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. --- Cython/Compiler/Nodes.py | 3 +-- tests/errors/builtin_type_conflict_T170.pyx | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 60dbc28c..68f12906 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2679,8 +2679,7 @@ class CClassDefNode(ClassDefNode): if self.visibility == 'extern': if self.module_name == '__builtin__' and self.class_name in Builtin.builtin_types: - error(self.pos, "%s already a builtin Cython type" % self.class_name) - return + warning(self.pos, "%s already a builtin Cython type" % self.class_name, 1) self.entry = home_scope.declare_c_class( name = self.class_name, diff --git a/tests/errors/builtin_type_conflict_T170.pyx b/tests/errors/builtin_type_conflict_T170.pyx index c1c8ac90..89d41536 100644 --- a/tests/errors/builtin_type_conflict_T170.pyx +++ b/tests/errors/builtin_type_conflict_T170.pyx @@ -3,6 +3,13 @@ cdef extern from *: pass cdef list foo = [] -_ERRORS = u""" + +# This is too invasive for Python 0.11.x, re-enable in 0.12 +NEW_ERRORS = u""" :2:4: list already a builtin Cython type """ + +_ERRORS = u""" +:5:16: Cannot coerce list to type 'list' +""" + -- 2.26.2