Commit e8fb800c authored by Stefan Behnel's avatar Stefan Behnel

clean up IntNode() instantiation

parent c349b076
...@@ -8463,7 +8463,7 @@ class CythonArrayNode(ExprNode): ...@@ -8463,7 +8463,7 @@ class CythonArrayNode(ExprNode):
if axis.stop.is_none: if axis.stop.is_none:
if array_dimension_sizes: if array_dimension_sizes:
dimsize = array_dimension_sizes[axis_no] dimsize = array_dimension_sizes[axis_no]
axis.stop = IntNode(self.pos, value=dimsize, axis.stop = IntNode(self.pos, value=str(dimsize),
constant_result=dimsize, constant_result=dimsize,
type=PyrexTypes.c_int_type) type=PyrexTypes.c_int_type)
else: else:
......
...@@ -301,7 +301,7 @@ class IterationTransform(Visitor.EnvTransform): ...@@ -301,7 +301,7 @@ class IterationTransform(Visitor.EnvTransform):
PyrexTypes.c_uchar_ptr_type, self.current_env()), PyrexTypes.c_uchar_ptr_type, self.current_env()),
start=None, start=None,
stop=ExprNodes.IntNode( stop=ExprNodes.IntNode(
slice_node.pos, value=len(bytes_value), slice_node.pos, value=str(len(bytes_value)),
constant_result=len(bytes_value), constant_result=len(bytes_value),
type=PyrexTypes.c_py_ssize_t_type), type=PyrexTypes.c_py_ssize_t_type),
type=Builtin.unicode_type, # hint for Python conversion type=Builtin.unicode_type, # hint for Python conversion
...@@ -2205,15 +2205,15 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform): ...@@ -2205,15 +2205,15 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
elif isinstance(arg, ExprNodes.UnicodeNode): elif isinstance(arg, ExprNodes.UnicodeNode):
if len(arg.value) == 1: if len(arg.value) == 1:
return ExprNodes.IntNode( return ExprNodes.IntNode(
ord(arg.value), type=PyrexTypes.c_int_type, arg.pos, type=PyrexTypes.c_int_type,
value=str(ord(arg.value)), value=str(ord(arg.value)),
constant_result=ord(arg.value) constant_result=ord(arg.value)
).coerce_to(node.type, self.current_env()) ).coerce_to(node.type, self.current_env())
elif isinstance(arg, ExprNodes.StringNode): elif isinstance(arg, ExprNodes.StringNode):
if arg.unicode_value and len(arg.unicode_value) == 1 \ 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( 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)), value=str(ord(arg.unicode_value)),
constant_result=ord(arg.unicode_value) constant_result=ord(arg.unicode_value)
).coerce_to(node.type, self.current_env()) ).coerce_to(node.type, self.current_env())
...@@ -2441,7 +2441,7 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform): ...@@ -2441,7 +2441,7 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
else: else:
is_safe_type = 0 # definitely not is_safe_type = 0 # definitely not
args.append(ExprNodes.IntNode( 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( return self._substitute_method_call(
node, function, node, function,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment