This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: DeprecationWarning not reported for invalid escape sequences
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder: Improve the warning message for invalid escape sequences
View: 28128
Assigned To: Nosy List: Sergey.Kirpichev, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-10-04 09:00 by Sergey.Kirpichev, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg278020 - (view) Author: Sergey B Kirpichev (Sergey.Kirpichev) * Date: 2016-10-04 09:00
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 
def f(s):
    return s != "hello \world"
$ cat 
import a
$ python 
$ python -W error 
msg278023 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-04 09:06
See issue28128.

A warning should be emitted when you compile the code, but it shouldn't be emitted when you import compiled module.
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72540
2016-10-04 09:06:49serhiy.storchakasetstatus: open -> closed

superseder: Improve the warning message for invalid escape sequences

nosy: + serhiy.storchaka
messages: + msg278023
resolution: duplicate
stage: resolved
2016-10-04 09:00:39Sergey.Kirpichevcreate