[New-bugs-announce] [issue30091] DeprecationWarning: invalid escape sequence: Only appears on first run

Jon Dufresne report at bugs.python.org
Mon Apr 17 13:19:05 EDT 2017


New submission from Jon Dufresne:

After upgrading to Python 3.6, I'm working towards cleaning up "DeprecationWarning: invalid escape sequence". I've noticed that the Deprecation warning only appears on the first run. It looks like once the code is compiled to `__pycache__`, the deprecation warning does not show. This makes debugging more difficult as I need clean out `__pycache__` directories for the runs to be reproducible.

Example script:

foo.py
```
import bar
```

bar.py
```
s = '\.'
```

First run
```
$ python36 -Wall foo.py 
.../test/bar.py:1: DeprecationWarning: invalid escape sequence \.
  s = '\.'
```

Second run (no DeprecationWarning)
```
$ python36 -Wall foo.py
```

Third run after cleaning
```
$ rm -rf __pycache__
$ python36 -Wall foo.py 
.../test/bar.py:1: DeprecationWarning: invalid escape sequence \.
  s = '\.'
```

I expect the deprecation warning to output on every run.

----------
components: Interpreter Core
messages: 291805
nosy: jdufresne
priority: normal
severity: normal
status: open
title: DeprecationWarning: invalid escape sequence: Only appears on first run
type: behavior
versions: Python 3.6

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


More information about the New-bugs-announce mailing list