[issue4335] inspect.getsourcelines ignores last line in module

Alexander Belopolsky report at bugs.python.org
Tue Dec 9 17:43:41 CET 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

You convinced me.  After all, if python interpreter does not complain 
about missing end-of-line and processes the unterminated line, getsource 
should report it.

Here is a patch that passes existing tests and adds a "NoEOF" test case.

I am adding 2.5.3 to the list of versions, but someone will have to 
lobby python-dev to make it happen.

Note that I've modernized the code a little bit by switching from a 
callback tokenizer to the newer token generator.  Hopefully this will 
make it easier to review the code, but I can easily produce an old-style  
patch as well.

----------
versions: +Python 2.5.3, Python 2.6, Python 2.7 -Python 2.5
Added file: http://bugs.python.org/file12304/issue4335.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4335>
_______________________________________


More information about the Python-bugs-list mailing list