James Mudd added the comment:
Could you provide more details on which version of Jython does it fail?
I have just tried this on master and it appears to work almost correctly. Jython returns the correct SyntaxError, with a slightly different message to CPython and the ^ highlighting the position of the error is wrong.
Jython 2.7.1b3 (, Feb 23 2017, 20:19:21)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> print "some text
File "<stdin>", line 1
print "some text
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print 'some text
File "<stdin>", line 1
print 'some text
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print 'some data
File "<stdin>", line 1
print 'some data
^
SyntaxError: no viable alternative at input '<EOF>'
>>> exec('def foo():\n return "bar\n')
>>> exec('a = "bar\n')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
a = "bar
^
SyntaxError: no viable alternative at input '='
>>>
The only example which actually failed for me (by which I mean incorrectly suceeded) was "exec('def foo():\n return "bar\n')" where no SyntaxError was raised. I will have a look at that one
----------
nosy: +jamesmudd
_______________________________________
Jython tracker <report@bugs.jython.org>
<http://bugs.jython.org/issue2466 >
_______________________________________