Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input prompt stripping broken with multiline data structures #678

Closed
fperez opened this issue Aug 4, 2011 · 2 comments
Closed

Input prompt stripping broken with multiline data structures #678

fperez opened this issue Aug 4, 2011 · 2 comments
Labels
Milestone

Comments

@fperez
Copy link
Member

fperez commented Aug 4, 2011

We now strip input prompts always, but the logic seems to be broken in certain cases, as reported by @matthew-brett on-list. Some cases that work:

In [3]: >>> x =1

In [4]: x
Out[4]: 1

In [5]: >>> if x:
   ...:     ...     print 1
   ...:     ...     
1

But multilie data structures throw an error:

In [2]: >>> a = {'X':1,
   ...: ... 'U':2}
  File "", line 2
    ... 'U':2}
    ^
SyntaxError: invalid syntax

In [6]: >>> a = [1,2,
   ...: ... 3]
  File "", line 2
    ... 3]
    ^
SyntaxError: invalid syntax

In [9]: >>> a = (1,2,
   ...: ... 3)
  File "", line 2
    ... 3)
    ^
SyntaxError: invalid syntax
djv pushed a commit to djv/ipython that referenced this issue Oct 14, 2011
djv pushed a commit to djv/ipython that referenced this issue Oct 18, 2011
@fperez
Copy link
Member Author

fperez commented Oct 18, 2011

#877 definitely improves things a lot. There's an edge case left standing, as indicated there:

In [3]: >>> a = [1
   ...: ... ,2]
  File "<ipython-input-3-5b39dccea2ae>", line 2
    ... ,2]
     ^
SyntaxError: invalid syntax

which happens to be valid in python.

But I'm lowering the priority b/c with this fix, most real-world cases are covered.

fperez added a commit that referenced this issue Oct 18, 2011
Now multiline structures pasted from doctests with input prompts work
in most regular cases.
@minrk
Copy link
Member

minrk commented Jun 19, 2013

fixed by #2447

@minrk minrk closed this as completed Jun 19, 2013
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
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Now multiline structures pasted from doctests with input prompts work
in most regular cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants