syntax error when raise is inside except process
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Triaged
|
Undecided
|
Unassigned |
Bug Description
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 "<ipython console>", 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
This looks like a problem with autoindent feature in ipython.
Anyway, now I disabled the autoindent to avoid it.