File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ def _multiply_seq_by_int(
142142 context : InferenceContext ,
143143) -> _TupleListNodeT :
144144 node = self .__class__ (parent = opnode )
145- if value <= 0 :
145+ if value <= 0 or not self . elts :
146146 node .elts = []
147147 return node
148148 if len (self .elts ) * value > 1e8 :
Original file line number Diff line number Diff line change @@ -293,13 +293,18 @@ def test_uninferable_list_multiplication_with_multiple_operands() -> None:
293293 element = parsed .inferred ()[0 ].elts [0 ]
294294 assert element .value is Uninferable
295295
296+ @staticmethod
297+ def test_list_multiplication_with_empty_list_and_overflowing_multiplier () -> None :
298+ parsed = extract_node ("[] * 1163845194457646539560" )
299+ assert parsed .inferred ()[0 ].elts == []
300+
296301 @staticmethod
297302 def test_list_multiplication_with_zero_multiplier () -> None :
298303 parsed = extract_node ("[0] * 0" )
299304 assert parsed .inferred ()[0 ].elts == []
300305
301306 @staticmethod
302- def test_list_multiplication_with_negative_multiplier () -> None :
307+ def test_list_multiplication_with_negative_overflowing_multiplier () -> None :
303308 parsed = extract_node ("[0] * -9223372036854775809" )
304309 assert parsed .inferred ()[0 ].elts == []
305310
You can’t perform that action at this time.
0 commit comments