New submission from STINNER Victor <vstin...@python.org>:

The PEP 587 says that PyConfig.warnoptions has the highest priority for 
warnings options:
https://www.python.org/dev/peps/pep-0587/#priority-and-rules

But in the current implementation, PyConfig.warnoptions has... the lowest 
priority :-(

Attached PR not only fix the issue but also add tests to ensure that every ways 
to set warnings options have the expected priority.

Priority of warnings options, lowest to highest:

- any implicit filters added by _warnings.c/warnings.py
- PyConfig.dev_mode: "default" filter
- PYTHONWARNINGS environment variable
- '-W' command line options
- PyConfig.bytes_warning ('-b', '-bb'): "default::BytesWarning"
  or "error::BytesWarning" filter
- early PySys_AddWarnOption() calls
- PyConfig.warnoptions

----------
components: Interpreter Core
messages: 353513
nosy: vstinner
priority: normal
severity: normal
status: open
title: PyConfig (PEP 587): PyConfig.warnoptions should have the highest priority
versions: Python 3.8, Python 3.9

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

Reply via email to