From ebcf2c43ce0a8d0431a50aec222e562365cef0cd Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Mon, 26 Oct 2009 12:56:23 +0100 Subject: [PATCH] Nicer error message for undeclared[idx] --- Cython/Compiler/ExprNodes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index ce0a6f2e..2dcecf2e 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1787,6 +1787,12 @@ class IndexNode(ExprNode): self.is_buffer_access = False self.base.analyse_types(env) + if self.base.type.is_error: + # Do not visit child tree if base is undeclared to avoid confusing + # error messages + self.type = PyrexTypes.error_type + return + # Handle the case where base is a literal char* (and we expect a string, not an int) if isinstance(self.base, BytesNode): self.base = self.base.coerce_to_pyobject(env) -- 2.26.2