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

multi-line parser fails on ''' in comment, qtconsole and notebook. #4134

Closed
pclinch opened this issue Aug 29, 2013 · 2 comments · Fixed by #4144
Closed

multi-line parser fails on ''' in comment, qtconsole and notebook. #4134

pclinch opened this issue Aug 29, 2013 · 2 comments · Fixed by #4144
Milestone

Comments

@pclinch
Copy link

pclinch commented Aug 29, 2013

def BSPLINE(p1,p2,p3,p4,divisions, spline_outX, spline_outY):
    '''Spline to straigh lines convertor, Simon hack from C?
    '''
    pass

#~ def store_mask( fname='arrow_mask.png' ):
    #~ '''Return byte string containing an image.
    #~ '''
    #~ mask = Image.open( fname )
    #~ return bz2.compress( pickle.dumps( list( mask.getdata() )))

Produces:-

#~ def store_mask( fname='arrow_mask.png' ):
    #~ '''Return byte string containing an image.

             ^
SyntaxError: invalid syntax

Apologies for crap markup.

@Carreau
Copy link
Member

Carreau commented Aug 29, 2013

That's actually the question mark which is catched :

def foo(x,y):
    """S?
    """
    pass

becomes :

def foo(x,y):
    get_ipython().set_next_input(u'    """S');get_ipython().magic(u'pinfo S')
    """
    pass

@takluyver ?

@pclinch
Copy link
Author

pclinch commented Aug 29, 2013

Good spot.

On 29 August 2013 12:33, Matthias Bussonnier notifications@github.comwrote:

That's actually the question mark which is catched :

def foo(x,y):
"""S?
"""
pass

becomes :

def foo(x,y):
get_ipython().set_next_input(u' """S');get_ipython().magic(u'pinfo S')
"""
pass

@takluyver https://github.com/takluyver ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4134#issuecomment-23482625
.

Regards, Paul C.

minrk added a commit that referenced this issue Sep 3, 2013
help_end transformer shouldn't pick up ? in multiline string

The help_end() transformer was already tokenizing the line to determine whether the ? was in a comment, so I just extended this to check for multi-line strings as well.

Closes #4134
minrk added a commit that referenced this issue Sep 4, 2013
…ine string

The help_end() transformer was already tokenizing the line to determine whether the ? was in a comment, so I just extended this to check for multi-line strings as well.

Possible for backporting to 1.1, but it's low priority, and this code is fairly sensitive, so it doesn't have to be.

Closes gh-4134
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
help_end transformer shouldn't pick up ? in multiline string

The help_end() transformer was already tokenizing the line to determine whether the ? was in a comment, so I just extended this to check for multi-line strings as well.

Closes ipython#4134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants