Issue2236
Created on 2014-12-13.09:54:05 by jeff.allen, last changed 2015-01-06.21:30:25 by fwierzbicki.
msg9230 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2014-12-13.09:54:05 |
|
The "as" keyword is not accepted in a try ... except construct. This should be available from Python 2.6.
>>> try:
... f = open("x.tmp")
... except IOError as ex:
File "<stdin>", line 3
except IOError as ex:
^
SyntaxError: mismatched input '<EOF>' expecting INDENT
A comma is acceptable to Jython for the same purpose.
Possibly an easy grammar fix since the code generation does not have to change. A test is clearly missing.
|
msg9231 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2014-12-13.10:31:16 |
|
That's odd. It works perfectly well when the source is a file, but not at the console. It is not sensitive to whether I use TAB or spaces.
>>> try:
... print 1/0
... except ZeroDivisionError, e:
... print "Ha!", e
...
Ha! integer division or modulo by zero
>>> try:
... print 1/0
... except ZeroDivisionError as e:
File "<stdin>", line 3
except ZeroDivisionError as e:
^
SyntaxError: mismatched input '<EOF>' expecting INDENT
And the error message is strangely irrelevant.
|
msg9235 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2014-12-15.18:04:41 |
|
I'm guessing that this is interactive prompt only - unfortunately they are separate grammars and I sometimes miss an update. Should be an easy fix.
|
msg9319 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2015-01-06.21:30:25 |
|
Fixed in https://hg.python.org/jython/rev/8f083cde280f
|
|
Date |
User |
Action |
Args |
2015-01-06 21:30:25 | fwierzbicki | set | status: open -> closed resolution: accepted -> fixed messages:
+ msg9319 |
2015-01-06 20:45:11 | fwierzbicki | set | title: try ... except E as e: syntax not accepted -> Interactive parser does not accept try ... except E as e: syntax |
2014-12-15 18:04:42 | fwierzbicki | set | assignee: fwierzbicki resolution: accepted messages:
+ msg9235 nosy:
+ fwierzbicki |
2014-12-13 10:31:17 | jeff.allen | set | messages:
+ msg9231 |
2014-12-13 09:54:05 | jeff.allen | create | |
|