[issue25567] shlex.quote doesn't work on bytestrings

Aldwin Pollefeyt report at bugs.python.org
Fri Jun 14 05:56:39 EDT 2019


Aldwin Pollefeyt <aldwinaldwin at gmail.com> added the comment:

Python 3.9.0a0
[GCC 7.3.0] on linux
>>> import re
>>> find_unsafe_bytes = re.compile(b'[^\w@%+=:,./-]').search
<stdin>:1: SyntaxWarning: invalid escape sequence \w

when removing \w, all the tests pass

(my regex knowledge is close to None.)

"\w stands for "word character". It always matches the ASCII characters [A-Za-z0-9_]"

replace \w with A-Za-z0-9_ ?? (all the tests pass)

----------
nosy: +aldwinaldwin

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue25567>
_______________________________________


More information about the Python-bugs-list mailing list