Commit 2d4b85db authored by Vitja Makarov's avatar Vitja Makarov

Fix literal tuple multiplication by non-literal integer

parent e5dc7523
...@@ -5061,6 +5061,8 @@ class TupleNode(SequenceNode): ...@@ -5061,6 +5061,8 @@ class TupleNode(SequenceNode):
self.is_temp = False self.is_temp = False
self.is_literal = True self.is_literal = True
else: else:
if not self.mult_factor.type.is_pyobject:
self.mult_factor = self.mult_factor.coerce_to_pyobject(env)
self.is_temp = True self.is_temp = True
self.is_partly_literal = True self.is_partly_literal = True
......
...@@ -224,6 +224,14 @@ def multiplied_nonconst_tuple_arg(x): ...@@ -224,6 +224,14 @@ def multiplied_nonconst_tuple_arg(x):
""" """
return (1,2) * x return (1,2) * x
@cython.test_fail_if_path_exists("//MulNode")
def multiplied_nonconst_tuple_int_arg(int x):
"""
>>> multiplied_nonconst_tuple_int_arg(5) == (1,2) * 5
True
"""
return (1,2) * x
@cython.test_fail_if_path_exists("//MulNode") @cython.test_fail_if_path_exists("//MulNode")
def multiplied_nonconst_tuple(x): def multiplied_nonconst_tuple(x):
""" """
......
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