From c8e8fd0378b3bce66e27144f9bc7c5de517ef2c8 2021-03-14 00:49:28 From: Blazej Michalik Date: 2021-03-14 00:49:28 Subject: [PATCH] Fix IndexError on a singular slash input --- diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py index a5229ae..c7deab8 100644 --- a/IPython/core/inputtransformer2.py +++ b/IPython/core/inputtransformer2.py @@ -678,7 +678,11 @@ class TransformerManager: # Bail if we got one line and there are more closing parentheses than # the opening ones - if len(lines) == 1 and has_sunken_brackets(tokens_by_line[0]): + if ( + len(lines) == 1 + and tokens_by_line + and has_sunken_brackets(tokens_by_line[0]) + ): return "invalid", None if not tokens_by_line: