On Wed, May 19, 2010 at 8:52 PM, Steven D'Aprano <steve-remove-t...@cybersource.com.au> wrote: > On Wed, 19 May 2010 22:31:31 +0000, Benjamin Peterson wrote: >> Iuri <iurisilvio <at> gmail.com> writes: >>> Any ideas about what is happening? >> >> Until Python 2.7/3.2, compile() does't like sources which don't end in a >> newline.
It appears to be this bug: http://bugs.python.org/issue1184112 which is still open. Maybe a fix got checked in without the bug being closed? I don't have 2.7 or 3.2 here to test with. > The original post isn't showing up for me, so I don't know the full > context, but it seems to me that compile can deal with the lack of > newline. The original example was: compile("for i in [1,2,3]:\n pass\n#end", "test_file.py", "exec") Bug 1184112 is only triggered with an indented block followed by a comment with no newline following the comment. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list