[issue1479099] 'compile' built-in function failures when missing EOL
Terry J. Reedy
report at bugs.python.org
Tue Oct 14 01:19:18 CEST 2008
Terry J. Reedy <tjreedy at udel.edu> added the comment:
As near as I can tell, for 2.5.2 and 3.0c1, the limitation on compile
only applies when the last line only contains a comment.
>>> print (compile("def f():\n pass #haha",'','exec'))
<code object <module> at 00AADAD0, file "", line 1>
>>> print (compile("def f():\n pass\n#haha",'','exec')) # or
>>> print (compile("def f():\n pass\n #haha",'','exec'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "", line 3
#haha
I would prefer more consistent behavior. I have opened a separate doc
issue that includes the documentation of this issue.
http://bugs.python.org/issue4118
----------
nosy: +tjreedy
versions: +Python 2.6, Python 2.7, Python 3.0
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1479099>
_______________________________________
More information about the Python-bugs-list
mailing list