From 20a896b20620362e7b3737dc6018b1cf47d84349 Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Mon, 24 Sep 2012 12:21:12 +0100 Subject: [PATCH] Start on array expressions --- translator.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/translator.py b/translator.py index e3cb5ff..8fef17b 100644 --- a/translator.py +++ b/translator.py @@ -1,6 +1,6 @@ # A handy translator that converts control flow into the appropriate # llvm_cbuilder constructs -from numba.functions import _get_ast +from numba.functions import _get_ast, fix_ast_lineno import inspect, functools, ast import logging @@ -13,18 +13,7 @@ def translate(func): tree = _get_ast(func) tree = ast.Module(body=tree.body) tree = ExpandControlFlow().visit(tree) - - # NOTE: A hack to fix assertion error in debug mode due to bad lineno. - # Lineno must increase monotonically for co_lnotab, - # the "line number table" to work correctly. - # This script just set all lineno to 1 and col_offset = to 0. - # This makes it impossible to do traceback, but it is not possible - # anyway since we are dynamically changing the source code. - for node in ast.walk(tree): - # only ast.expr and ast.stmt and their subclass has lineno and col_offset. - if isinstance(node, ast.expr) or isinstance(node, ast.stmt): - node.lineno = 1 - node.col_offset = 0 + fix_ast_lineno(tree) # prepare locals for execution local_dict = locals()