New submission from Jason Yundt <swagfortr...@gmail.com>:

I have a script which always produces a warning when you run it. If I import 
always_warns from another script, that script will only produce a warning once.

Steps to reproduce:
$ python -W always always_warns.py
/tmp/Bug reproduction/always_warns.py:1: DeprecationWarning: invalid escape 
sequence \ 
  "\ "
$ python -W always always_warns.py
/tmp/Bug reproduction/always_warns.py:1: DeprecationWarning: invalid escape 
sequence \ 
  "\ "
$ python -W always imports_always_warns.py
/tmp/Bug reproduction/always_warns.py:1: DeprecationWarning: invalid escape 
sequence \ 
  "\ "
$ python -W always imports_always_warns.py
$

There should be a warning for that last one, but there isn’t. If I delete 
__pycache__, imports_always_warns.py makes the warning appear again.

----------
files: Bug reproduction.zip
messages: 401648
nosy: jayman
priority: normal
severity: normal
status: open
title: No warning with '-W always' and cached import
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50278/Bug reproduction.zip

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45175>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to