From: Stefan Behnel Date: Tue, 15 Jun 2010 20:34:10 +0000 (+0200) Subject: merged in latest cython-devel X-Git-Tag: 0.13.beta0~2^2~23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4329d08e9e50749460eadd62812080763ac5a588;p=cython.git merged in latest cython-devel --- 4329d08e9e50749460eadd62812080763ac5a588 diff --cc Cython/Compiler/ExprNodes.py index 5273419b,cdf26701..f5fc0425 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@@ -19,8 -18,8 +19,9 @@@ from Builtin import list_type, tuple_ty import Builtin import Symtab import Options + from Cython import Utils from Annotate import AnnotationItem +from Cython import Utils from Cython.Debugging import print_call_chain from DebugFlags import debug_disposal_code, debug_temp_alloc, \ diff --cc Cython/Compiler/TypeInference.py index 38f80498,e0daaabc..9335d72a --- a/Cython/Compiler/TypeInference.py +++ b/Cython/Compiler/TypeInference.py @@@ -175,9 -176,27 +176,27 @@@ class MarkOverflowingArithmetic(CythonT visit_InPlaceAssignmentNode = visit_dangerous_node visit_Node = visit_safe_node - + + def visit_assignment(self, lhs, rhs): + if (isinstance(rhs, ExprNodes.IntNode) + and isinstance(lhs, ExprNodes.NameNode) + and Utils.long_literal(rhs.value)): + entry = lhs.entry or self.env.lookup(lhs.name) + if entry: + entry.might_overflow = True + + def visit_SingleAssignmentNode(self, node): + self.visit_assignment(node.lhs, node.rhs) + self.visitchildren(node) + return node + + def visit_CascadedAssignmentNode(self, node): + for lhs in node.lhs_list: + self.visit_assignment(lhs, node.rhs) + self.visitchildren(node) + return node -class PyObjectTypeInferer: +class PyObjectTypeInferer(object): """ If it's not declared, it's a PyObject. """