From d4f41859f3d9080e99ac607a7f589e67c9805fd3 2018-10-02 04:03:58 From: Tony Fast Date: 2018-10-02 04:03:58 Subject: [PATCH] Fix an IndexError in leading_indent --- diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py index 1abd2cf..c9aff48 100644 --- a/IPython/core/inputtransformer2.py +++ b/IPython/core/inputtransformer2.py @@ -24,6 +24,8 @@ def leading_indent(lines): If the first line starts with a spaces or tabs, the same whitespace will be removed from each following line in the cell. """ + if not lines: + return lines m = _indent_re.match(lines[0]) if not m: return lines