Roundup Robot added the comment:
New changeset 7e40c940df14 by Vinay Sajip in branch '3.6':
Fixed #29132: Updated shlex to work better with punctuation chars in POSIX mode.
https://hg.python.org/cpython/rev/7e40c940df14
New changeset c163a76163f7 by Vinay Sajip in branch 'default':
Closes
Evan added the comment:
I've just submitted the form.
I'm attaching a second patch which also addresses another similar bug
demonstrated in the test case. The fix is to check for the 'c' state before
checking for quotes or escape characters.
--
Added file:
Vinay Sajip added the comment:
Evan, thanks for looking at this. Would you like to submit a completed
contributor form?
https://www.python.org/psf/contrib/contrib-form/
--
___
Python tracker
Evan added the comment:
I've attached a simplistic patch which fixes the problem. I suspect a better
fix might be to shuffle the elif branches around so the extra condition isn't
necessary. Vinay, what are your thoughts?
--
keywords: +patch
Added file:
New submission from Evan:
When both punctuation_chars and posix are used, any punctuation directly next
to quoted characters is interpreted as a single token.
>>> from shlex import shlex
>>> list(shlex('>"a"', posix=True))
['>', 'a']
>>> list(shlex('>"a"', punctuation_chars=True))
['>', '"a"']