multiline strings at end of input cause noop #306

Closed
ivanov opened this Issue Mar 25, 2011 · 5 comments

Comments

Projects
None yet
3 participants
@ivanov
Member

ivanov commented Mar 25, 2011

Overview

Triple-quoted strings cause expressions before or after it to be ignored and not executed (in both qtconsole and terminal)

Note how the error from In[2] is suppressed, and expression in In[3] not
evaluated in trunk, whereas the desired behavior occurred in 0.10.2.

trunk behavior:

In [1]: a
NameError                                 Traceback (most recent call last)
/home/pi/ in ()
----> 1 a
NameError: name 'a' is not defined
In [2]: a;"""
   ...: """

In [3]: a=10;"""
   ...: """

In [4]: a
NameError                                 Traceback (most recent call last)
/home/pi/ in ()
----> 1 a

NameError: name 'a' is not defined

0.10.2 behavior

In [1]: a
NameError                                 Traceback (most recent call last)
/home/pi/ in ()
NameError: name 'a' is not defined

In [2]: a;"""
   ...: """
NameError                                 Traceback (most recent call last)
/home/pi/ in ()
NameError: name 'a' is not defined

In [3]: a=10;"""
   ...: """
Out[3]: '\n'

In [4]: a
Out[4]: 10
@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Mar 25, 2011

Member

Thanks for the report, Paul. This is most certainly a bug in core.inputsplitter. Fortunately it's easy to write a clean test for it, I'm not quite sure what the actual fix is quite yet though.

Member

fperez commented Mar 25, 2011

Thanks for the report, Paul. This is most certainly a bug in core.inputsplitter. Fortunately it's easy to write a clean test for it, I'm not quite sure what the actual fix is quite yet though.

@ivanov

This comment has been minimized.

Show comment
Hide comment
@ivanov

ivanov Mar 25, 2011

Member

test for this bug is in trunk as of 94644f8. You will find it in the file IPython/core/tests/test_interactiveshell.py - please remove the skip_known_failure decorator to work on this bug.

Member

ivanov commented Mar 25, 2011

test for this bug is in trunk as of 94644f8. You will find it in the file IPython/core/tests/test_interactiveshell.py - please remove the skip_known_failure decorator to work on this bug.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 26, 2011

Member

This might be a result of my switch to using ast instead of compiler. Our own inputsplitter gets it right, but then we rejoin it and split it again based on ast. That gives us the two lines as separate blocks, neither of which is valid.

Member

takluyver commented Mar 26, 2011

This might be a result of my switch to using ast instead of compiler. Our own inputsplitter gets it right, but then we rejoin it and split it again based on ast. That gives us the two lines as separate blocks, neither of which is valid.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 7, 2011

Member

This is fixed in my ast-splitter branch: https://github.com/takluyver/ipython/commits/ast-splitter

Member

takluyver commented Apr 7, 2011

This is fixed in my ast-splitter branch: https://github.com/takluyver/ipython/commits/ast-splitter

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 7, 2011

Member

Enable test for cells ending in multiline strings, as it now passes.

Closed by 4863c51

Member

takluyver commented Apr 7, 2011

Enable test for cells ending in multiline strings, as it now passes.

Closed by 4863c51

@takluyver takluyver closed this Apr 7, 2011

markvoorhies pushed a commit to markvoorhies/ipython that referenced this issue Apr 21, 2011

markvoorhies pushed a commit to markvoorhies/ipython that referenced this issue Apr 21, 2011

ivanov added a commit to ivanov/ipython that referenced this issue Jan 25, 2012

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment