summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ExprNodes.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-02-18 20:34:35 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-02-18 20:34:35 +0100
commitade960981c4a5021e951bec15f2caae5f3ab0241 (patch)
treefaebb761b2a6facee43e533e9939f4df04416f1e /Cython/Compiler/ExprNodes.py
parent691eabf900677990b4b3b23353630b65f179ddf1 (diff)
downloadcython-ade960981c4a5021e951bec15f2caae5f3ab0241.tar.gz
Avoid checking "signed" type attribute for non-numeric types (which don't have it).
Diffstat (limited to 'Cython/Compiler/ExprNodes.py')
-rw-r--r--Cython/Compiler/ExprNodes.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 2099346e8..af989726f 100644
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -11542,9 +11542,11 @@ class DivNode(NumBinopNode):
def generate_evaluation_code(self, code):
if not self.type.is_pyobject and not self.type.is_complex:
if self.cdivision is None:
- self.cdivision = (code.globalstate.directives['cdivision']
- or not self.type.signed
- or self.type.is_float)
+ self.cdivision = (
+ code.globalstate.directives['cdivision']
+ or self.type.is_float
+ or ((self.type.is_numeric or self.type.is_enum) and not self.type.signed)
+ )
if not self.cdivision:
code.globalstate.use_utility_code(
UtilityCode.load_cached("DivInt", "CMath.c").specialize(self.type))