From 36549f78f500cc0b503d4cb82ce7c8ca38049ecb Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 5 Sep 2007 11:39:47 -0700 Subject: [PATCH] Better error for ** on integer types. --- Cython/Compiler/ExprNodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 80b0845e..0dfa8633 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2610,6 +2610,15 @@ class PowNode(NumBinopNode): def c_types_okay(self, type1, type2): return type1.is_float or type2.is_float + def type_error(self): + if not (self.operand1.type.is_error or self.operand2.type.is_error): + if self.operand1.type.is_int and self.operand2.type.is_int: + error(self.pos, "C has no integer powering, use python ints or floats instead '%s' (%s; %s)" % + (self.operator, self.operand1.type, self.operand2.type)) + else: + NumBinopNode.type_error(self) + self.type = PyrexTypes.error_type + def calculate_result_code(self): return "pow(%s, %s)" % ( self.operand1.result_code, self.operand2.result_code) -- 2.26.2