[issue42668] re.escape does not correctly escape newlines
Serhiy Storchaka
report at bugs.python.org
Thu Dec 17 08:02:31 EST 2020
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
> If the escape-result still contains a verbatim newline, why escape this character at all?
Because in verbose mode it is ignored. This is why \n and other ASCII whitespace characters, and '#', which starts a comment, should be escaped.
'\\\n' and '\\n' has identical meaning independent of mode and context, so there is no bug here. Escaping '\n' as '\\\n' is slightly simpler.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42668>
_______________________________________
More information about the Python-bugs-list
mailing list