diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py index 3c992d8..63cf1d7 100644 --- a/IPython/core/inputtransformer2.py +++ b/IPython/core/inputtransformer2.py @@ -636,7 +636,7 @@ class TransformerManager: MemoryError, SyntaxWarning): return 'invalid', None else: - if not lines[-1].strip().endswith(':'): + if len(lines) > 1 and not lines[-1].strip().endswith(':'): return 'incomplete', find_last_indent(lines) return 'complete', None