From: Stefan Behnel Date: Thu, 25 Nov 2010 06:44:59 +0000 (+0100) Subject: fix result types for C math operations on Python booleans X-Git-Tag: 0.14.alpha0~90 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=60f24e7f73249fb2fac2ef88ebd68cef0a27f1e2;p=cython.git fix result types for C math operations on Python booleans --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 9bcd2b98..86fc0bff 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -5651,7 +5651,12 @@ class NumBinopNode(BinopNode): def compute_c_result_type(self, type1, type2): if self.c_types_okay(type1, type2): - return PyrexTypes.widest_numeric_type(type1, type2) + widest_type = PyrexTypes.widest_numeric_type(type1, type2) + if widest_type is PyrexTypes.c_bint_type: + if self.operator not in '|^&': + # False + False == 0 # not False! + widest_type = PyrexTypes.c_int_type + return widest_type else: return None