From: Dag Sverre Seljebotn Date: Mon, 26 Oct 2009 11:56:23 +0000 (+0100) Subject: Nicer error message for undeclared[idx] X-Git-Tag: 0.12.alpha0~15 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebcf2c43ce0a8d0431a50aec222e562365cef0cd;p=cython.git Nicer error message for undeclared[idx] --- 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)