From 60f24e7f73249fb2fac2ef88ebd68cef0a27f1e2 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 25 Nov 2010 07:44:59 +0100 Subject: [PATCH] fix result types for C math operations on Python booleans --- Cython/Compiler/ExprNodes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.26.2