Issue 3370: importing with_statement causes exec to raise syntax error on block that doesn't end with a newline (original) (raw)

Issue3370

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 "", line 1, in File "", 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:36 admin set github: 47620
2009-02-11 04:52:10 ajaksu2 set status: open -> closedresolution: out of datemessages: + nosy: + ajaksu2
2008-07-15 23:40:46 dochoncho set nosy: + dochonchomessages: +
2008-07-15 22:20:35 mccredie create