IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 347 forks source link

Missing a newline at the end of the text field of SyntaxError exceptions (2.7 change) #843

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

D:\rft\vsl\dlr\Languages\IronPython\Tests>27
Python 2.7b1 (r27b1:79929, Apr 10 2010, 22:43:08) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

try:
... compile("if 2==2: x=2\nelse:y=", "Error", "exec")
... except SyntaxError, se:
... pass
...
se.text
'else:y=\n'
^Z

D:\rft\vsl\dlr\Languages\IronPython\Tests>26
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
try:
... compile("if 2==2: x=2\nelse:y=", "Error", "exec")
... except SyntaxError, se:
... pass
...
se.text
'else:y='
^Z

D:\rft\vsl\dlr\Languages\IronPython\Tests>ipyd
IronPython 2.6.1 DEBUG (2.6.10920.0) on .NET 4.0.30319.1
Type "help", "copyright", "credits" or "license" for more information.
try:
... compile("if 2==2: x=2\nelse:y=", "Error", "exec")
... except SyntaxError, se:
... pass
...
se.text
'else:y='

Work Item Details

Original CodePlex Issue: Issue 27989 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 6, 2010 at 10:31 PM Reported by: dfugate Updated on: Feb 22, 2013 at 2:10 AM Updated by: jdhardy Test: test_exceptions.py (test_syntax_error_exception)

slozier commented 8 years ago
try:
    compile("if 2==2: x=2\nelse: y=","Error","exec")
except SyntaxError, se:
     pass

assert se.text == 'else: y=\n'