This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importing with_statement causes exec to raise syntax error on block that doesn't end with a newline
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, dochoncho, mccredie
Priority: normal Keywords:

Created on 2008-07-15 22:20 by mccredie, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg69723 - (view) Author: Matt McCredie (mccredie) Date: 2008-07-15 22:20
The following session demonstrates the issue:

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exec "def foo():\n    return 0" # no ending newline works fine
>>> foo()
0
>>> exec "def foo():\n    return 1\n" # with an ending newline works fine
>>> foo()
1
>>> from __future__ import with_statement
>>> exec "def foo():\n    return 2\n" # with an ending newline works fine
>>> foo()
2
>>> exec "def foo():\n    return 3" # without an ending new line... breaks

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 2
    return 3
          ^ 


Possibly related to http://bugs.python.org/issue1184112, and/or
http://bugs.python.org/issue501622?
msg69727 - (view) Author: Joel Madigan (dochoncho) Date: 2008-07-15 23:40
Confirmed in Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)

Seems to be fixed in 2.6b1.
msg81628 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-11 04:52
Closing: fixed in trunk, 2.5 won't be receiving bugfixes anymore.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47620
2009-02-11 04:52:10ajaksu2setstatus: open -> closed
resolution: out of date
messages: + msg81628
nosy: + ajaksu2
2008-07-15 23:40:46dochonchosetnosy: + dochoncho
messages: + msg69727
2008-07-15 22:20:35mccrediecreate