diff options
author | Éric Araujo <merwok@netwok.org> | 2011-08-09 21:18:06 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-08-09 21:18:06 (GMT) |
commit | 7fc0394a12d4bb5632424bfdfd4bb35590dec2e5 (patch) | |
tree | ad4b890d2fe33e31c5a85b9476fe317311227f37 /Lib/shlex.py | |
parent | 18205baf251495b5a54b08c1f9b0e1763eb27aa1 (diff) | |
parent | ef1e94a848533f2e7dbb2ed7a8b2de50e97e4b7f (diff) | |
download | cpython-7fc0394a12d4bb5632424bfdfd4bb35590dec2e5.zip cpython-7fc0394a12d4bb5632424bfdfd4bb35590dec2e5.tar.gz cpython-7fc0394a12d4bb5632424bfdfd4bb35590dec2e5.tar.bz2 |
Avoid unwanted behavior change in shlex.quote (see #9723).
I simplified the quote code to use a regex instead of a loop+test when I
moved pipes.quote to shlex in 5966eeb0457d; Ezio Melotti pointed out
that my regex contained redundant parts (now removed) and allowed
non-ASCII characters (now disallowed).
I think common UNIX shells don’t quote non-ASCII characters, but there’s
no harm in doing so. We’ll see if users request a change.
Diffstat (limited to 'Lib/shlex.py')
-rw-r--r-- | Lib/shlex.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/shlex.py b/Lib/shlex.py index 279ab48..92c49c3 100644 --- a/Lib/shlex.py +++ b/Lib/shlex.py @@ -276,7 +276,7 @@ def split(s, comments=False, posix=True): return list(lex) -_find_unsafe = re.compile(r'[^\w\d@%_\-\+=:,\./]').search +_find_unsafe = re.compile(r'[^\w@%\-\+=:,\./]', re.ASCII).search def quote(s): """Return a shell-escaped version of the string *s*.""" |