diff --git a/IPython/core/inputsplitter.py b/IPython/core/inputsplitter.py index 0856a53..b1c18a9 100644 --- a/IPython/core/inputsplitter.py +++ b/IPython/core/inputsplitter.py @@ -758,9 +758,11 @@ class IPythonInputSplitter(InputSplitter): try: push = super(IPythonInputSplitter, self).push + buf = self._buffer for line in lines_list: - if self._is_complete or not self._buffer or \ - (self._buffer and self._buffer[-1].rstrip().endswith(':')): + if self._is_complete or not buf or \ + (buf and (buf[-1].rstrip().endswith(':') or + buf[-1].rstrip().endswith(',')) ): for f in transforms: line = f(line) diff --git a/IPython/core/tests/test_inputsplitter.py b/IPython/core/tests/test_inputsplitter.py index bf1d79c..c1ba2b7 100644 --- a/IPython/core/tests/test_inputsplitter.py +++ b/IPython/core/tests/test_inputsplitter.py @@ -534,6 +534,12 @@ syntax_ml = \ (' ....: ', ''), ], ], + + multiline_datastructure = + [ [('>>> a = [1,','a = [1,'), + ('... 2]','2]'), + ], + ], )