return kills IPython #704

Closed
asmeurer opened this Issue Aug 16, 2011 · 3 comments

2 participants

@asmeurer

If you type just

return

in IPython, it dies with SyntaxError: 'return' outside function (<ipython-input-1-64672a10de46>, line 1). I can paste the whole traceback here if you want.

@asmeurer

Sorry, I pressed my Return key, and it let me enter the issue with a blank description. I will edit it to what I want...

@fperez
IPython member

Wow, nasty... Will fix now, thanks for the report!

@fperez fperez added a commit that closed this issue Aug 16, 2011
@fperez fperez Prevent crash from invalid code such as a bare 'return'.
More generally, catch any exceptions from code that may have parsed
into an AST tree but doesn't actually compile.

Closes gh-704.
1a64b37
@fperez fperez closed this in 1a64b37 Aug 16, 2011
@asmeurer

Nice. I can confirm that this works now.

Thanks for the super quick fix!

@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@fperez fperez Prevent crash from invalid code such as a bare 'return'.
More generally, catch any exceptions from code that may have parsed
into an AST tree but doesn't actually compile.

Closes gh-704.
eb8d3ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment