[issue28595] shlex.shlex should not augment wordchars

Evan report at bugs.python.org
Mon Nov 14 01:01:06 EST 2016


Evan added the comment:

I have some additional concerns with the changes introduced in http://bugs.python.org/issue1521950:

1. The fact that posix defaults to False in shlex.shlex (but not in shlex.split) is a huge beginner trap. If users are expecting to use this for "compatibility with the parsing performed by common Unix shells like bash, dash, and sh", they must also remember to set posix=True. The documentation for punctuation_chars makes no mention of this. The examples use non-POSIX mode parsing rules.

2. Even with posix=True, there is no mechanism to escape characters that are special inside double quotes, like $. This is a separate unaddressed incompatibility.

For 1, this could be fixed by making posix default to True if punctuation_chars is specified. Longer term, perhaps the default could be changed to True in all cases. I'm not sure what to do about 2.

(Please let me know if I should split these out into separate issues.)

----------

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


More information about the Python-bugs-list mailing list