diff --git a/IPython/core/inputtransformer.py b/IPython/core/inputtransformer.py index 4559a7b..f9c22e1 100644 --- a/IPython/core/inputtransformer.py +++ b/IPython/core/inputtransformer.py @@ -381,7 +381,7 @@ def _strip_prompts(prompt_re): @CoroutineInputTransformer.wrap def classic_prompt(): """Strip the >>>/... prompts of the Python interactive shell.""" - prompt_re = re.compile(r'^(>>> |^\.\.\. )') + prompt_re = re.compile(r'^(>>> ?|^\.\.\. ?)') return _strip_prompts(prompt_re) @CoroutineInputTransformer.wrap diff --git a/IPython/core/tests/test_inputtransformer.py b/IPython/core/tests/test_inputtransformer.py index 5c4adad..ddc82ec 100644 --- a/IPython/core/tests/test_inputtransformer.py +++ b/IPython/core/tests/test_inputtransformer.py @@ -180,6 +180,10 @@ syntax_ml = \ ('123','123'), ('... 456"""','... 456"""'), ], + [('>>> def f(x):', 'def f(x):'), + ('...', ''), + ('... return x', ' return x'), + ], ], ipy_prompt =