diff --git a/Lib/shlex.py b/Lib/shlex.py index 279ab484059..92c49c36084 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*.""" diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py index ea3d777ceba..d4463f30048 100644 --- a/Lib/test/test_shlex.py +++ b/Lib/test/test_shlex.py @@ -176,7 +176,8 @@ def testCompat(self): def testQuote(self): safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./' - unsafe = '"`$\\!' + unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s + unsafe = '"`$\\!' + unicode_sample self.assertEqual(shlex.quote(''), "''") self.assertEqual(shlex.quote(safeunquoted), safeunquoted)