This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author daniel-s
Recipients daniel-s
Date 2013-09-29.02:35:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380422113.39.0.502795028764.issue19120@psf.upfronthosting.co.za>
In-reply-to
Content
See the example below (also attached).

First example: The lineno reported just after "word2" is pulled is 2.
Second example: The lineno reported just after "," is pulled is still 1.

This behaviour seems inconsistent. The lineno should increment either when the last token of a line is pulled, or after the first token from the next line (in my opinion preferably the former). It should not have different bahaviour depending on what type of token that is (alpha vs. comma).

I have repeated this on 

Also, does Issue 16121 relate to this?


#!/usr/bin/env python
import shlex

first = shlex.shlex("word1 word2\nword3")
print (first.get_token())
print (first.get_token())
print ("line no", first.lineno)
print ("")

second = shlex.shlex("word1 word2,\nword3")
print (second.get_token())
print (second.get_token())
print (second.get_token())
print ("line no", second.lineno)


# Output:
# word1
# word2
# line no 2
#
# word1
# word2
# ,
# line no 1
History
Date User Action Args
2013-09-29 02:35:13daniel-ssetrecipients: + daniel-s
2013-09-29 02:35:13daniel-ssetmessageid: <1380422113.39.0.502795028764.issue19120@psf.upfronthosting.co.za>
2013-09-29 02:35:13daniel-slinkissue19120 messages
2013-09-29 02:35:12daniel-screate