From e8fb800c282d5e088ad945ff4ca31eeeeb4465ad Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 11 Dec 2013 22:35:24 +0100 Subject: [PATCH] clean up IntNode() instantiation --- Cython/Compiler/ExprNodes.py | 2 +- Cython/Compiler/Optimize.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index ae415c4..eb8f14c 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -8463,7 +8463,7 @@ class CythonArrayNode(ExprNode): if axis.stop.is_none: if array_dimension_sizes: dimsize = array_dimension_sizes[axis_no] - axis.stop = IntNode(self.pos, value=dimsize, + axis.stop = IntNode(self.pos, value=str(dimsize), constant_result=dimsize, type=PyrexTypes.c_int_type) else: diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 3596e50..f9ccbda 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -301,7 +301,7 @@ class IterationTransform(Visitor.EnvTransform): PyrexTypes.c_uchar_ptr_type, self.current_env()), start=None, stop=ExprNodes.IntNode( - slice_node.pos, value=len(bytes_value), + slice_node.pos, value=str(len(bytes_value)), constant_result=len(bytes_value), type=PyrexTypes.c_py_ssize_t_type), type=Builtin.unicode_type, # hint for Python conversion @@ -2205,15 +2205,15 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform): elif isinstance(arg, ExprNodes.UnicodeNode): if len(arg.value) == 1: return ExprNodes.IntNode( - ord(arg.value), type=PyrexTypes.c_int_type, + arg.pos, type=PyrexTypes.c_int_type, value=str(ord(arg.value)), constant_result=ord(arg.value) ).coerce_to(node.type, self.current_env()) elif isinstance(arg, ExprNodes.StringNode): if arg.unicode_value and len(arg.unicode_value) == 1 \ - and ord(arg.unicode_value) <= 255: # Py2/3 portability + and ord(arg.unicode_value) <= 255: # Py2/3 portability return ExprNodes.IntNode( - ord(arg.unicode_value), type=PyrexTypes.c_int_type, + arg.pos, type=PyrexTypes.c_int_type, value=str(ord(arg.unicode_value)), constant_result=ord(arg.unicode_value) ).coerce_to(node.type, self.current_env()) @@ -2441,7 +2441,7 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform): else: is_safe_type = 0 # definitely not args.append(ExprNodes.IntNode( - node.pos, value=is_safe_type, constant_result=is_safe_type)) + node.pos, value=str(is_safe_type), constant_result=is_safe_type)) return self._substitute_method_call( node, function, -- 2.7.4