[issue28354] DeprecationWarning not reported for invalid escape sequences

Sergey B Kirpichev report at bugs.python.org
Tue Oct 4 05:00:39 EDT 2016


New submission from Sergey B Kirpichev:

We know from release notes, that "A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning".  Sometimes it's true:
$ python -W error
Python 3.6.0b1+ (default, Oct  4 2016, 08:47:51) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> "xxx" != "hello \world"
DeprecationWarning: invalid escape sequence '\w'

But shouldn't DeprecationWarning be in the following case as well?

$ cat a.py 
def f(s):
    return s != "hello \world"
$ cat b.py 
import a
print(a.f("xxx"))
$ python b.py 
True
$ python -W error b.py 
True

----------
components: Interpreter Core
messages: 278020
nosy: Sergey.Kirpichev
priority: normal
severity: normal
status: open
title: DeprecationWarning not reported for invalid escape sequences
versions: Python 3.6

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


More information about the Python-bugs-list mailing list