[issue16121] shlex.shlex.error_leader() reports incorrect line number

Birk Nilson report at bugs.python.org
Sat Feb 23 21:54:13 CET 2013


Birk Nilson added the comment:

The implementation incremented the line number immediately when a newline was detected, even before the token had been processed completely - causing the issue Arfrever posted.

This also caused the unexpected behavior of a tokens line number including the amount of lines within the token itself. In other words '"a \n b \n c" \n d' would result in the token "a \n b \n c" to have the line number #3, followed by "d" being on the expected line #4. In my patch, the expected behavior of seeing the first token on line #1 and the second on #4 is introduced.

I also added the testLineNumbers method in the test suite - included in the patch.

----------
keywords: +patch
nosy: +birknilson
Added file: http://bugs.python.org/file29207/issue16121.patch

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


More information about the Python-bugs-list mailing list