File tree 2 files changed +7
-2
lines changed 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(
142
142
context : InferenceContext ,
143
143
) -> _TupleListNodeT :
144
144
node = self .__class__ (parent = opnode )
145
- if value <= 0 :
145
+ if value <= 0 or not self . elts :
146
146
node .elts = []
147
147
return node
148
148
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:
293
293
element = parsed .inferred ()[0 ].elts [0 ]
294
294
assert element .value is Uninferable
295
295
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
+
296
301
@staticmethod
297
302
def test_list_multiplication_with_zero_multiplier () -> None :
298
303
parsed = extract_node ("[0] * 0" )
299
304
assert parsed .inferred ()[0 ].elts == []
300
305
301
306
@staticmethod
302
- def test_list_multiplication_with_negative_multiplier () -> None :
307
+ def test_list_multiplication_with_negative_overflowing_multiplier () -> None :
303
308
parsed = extract_node ("[0] * -9223372036854775809" )
304
309
assert parsed .inferred ()[0 ].elts == []
305
310
You can’t perform that action at this time.
0 commit comments