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

syntax error when raise is inside except process #76

Closed
ipython opened this issue May 10, 2010 · 3 comments
Closed

syntax error when raise is inside except process #76

ipython opened this issue May 10, 2010 · 3 comments
Milestone

Comments

@ipython
Copy link
Collaborator

ipython commented May 10, 2010

Original Launchpad bug 525112: https://bugs.launchpad.net/ipython/+bug/525112
Reported by: talich (Jianping Hua).

Python 2.6.2, ipython 0.10, Mac OSX leopard.

I need to re-raise some exception in the exception processing, but when I copy & paste the copy from my editor for following test code, I encounter the syntax error.

The code:

try:
    a = 5
except:
    raise
else:
    print a

The ipython error:
In [565]: try:
   .....:         a = 5
   .....: except:
   .....:         raise
   .....: else:
------------------------------------------------------------
   File "", line 5
     lse:
       ^
SyntaxError: invalid syntax

If I manually input the above code, there is no problem:

In [568]: try:
   .....:     a = 5
   .....: except:  
   .....:     raise
   .....: else:
   .....:     print a
   .....:     
   .....:     
5

But even with manual input, if I add 4 additional space at each indention (actually only the one before 'raise' matters), I got the same error

@ipython
Copy link
Collaborator Author

ipython commented May 10, 2010

[ LP comment 1 by: Jianping Hua, on 2010-02-21 09:16:42.439350+00:00 ]

This looks like a problem with autoindent feature in ipython.

Anyway, now I disabled the autoindent to avoid it.

@ipython
Copy link
Collaborator Author

ipython commented May 10, 2010

[ LP comment 2 by: Fernando Perez, on 2010-04-26 01:39:35.451696+00:00 ]

Correct, I can reproduce the bug though, so we should be able to track it down. Thanks for reporting it.

@fperez
Copy link
Member

fperez commented Mar 13, 2011

This is now fixed in 0.10.2, soon to be released.

There is however a problem with trying to input something like the above code, which fails in 0.11. I'll open a separate issue for that. Closing this one though, since it's now fixed.

This issue was closed.
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

No branches or pull requests

1 participant