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 jjdmol2
Recipients jjdmol2
Date 2009-10-09.08:11:50
SpamBayes Score 7.248836e-08
Marked as misclassified No
Message-id <1255075914.03.0.04545559487.issue7089@psf.upfronthosting.co.za>
In-reply-to
Content
The shlex module does not function as expected in the presence of
comments when newlines are not whitespace. An example (attached):

>>> from shlex import shlex
>>> 
>>> lexer = shlex("a \n b")
>>> print ",".join(lexer)
a,b
>>> 
>>> lexer = shlex("a # comment \n b")
>>> print ",".join(lexer)
a,b
>>> 
>>> lexer = shlex("a \n b")
>>> lexer.whitespace=" "
>>> print ",".join(lexer)
a,
,b
>>> 
>>> lexer = shlex("a # comment \n b")
>>> lexer.whitespace=" "
>>> print ",".join(lexer)
a,b

Now where did my newline go? The comment ate it! Even though the docs
seem to indicate the newline is not part of the comment itself:

shlex.commenters:
    The string of characters that are recognized as comment beginners.
All characters from the comment beginner to end of line are ignored.
Includes just '#' by default.
History
Date User Action Args
2009-10-09 08:11:54jjdmol2setrecipients: + jjdmol2
2009-10-09 08:11:54jjdmol2setmessageid: <1255075914.03.0.04545559487.issue7089@psf.upfronthosting.co.za>
2009-10-09 08:11:51jjdmol2linkissue7089 messages
2009-10-09 08:11:51jjdmol2create