[New-bugs-announce] [issue38317] PyConfig (PEP 587): PyConfig.warnoptions should have the highest priority

STINNER Victor report at bugs.python.org
Sun Sep 29 18:54:37 EDT 2019


New submission from STINNER Victor <vstinner at 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 <report at bugs.python.org>
<https://bugs.python.org/issue38317>
_______________________________________


More information about the New-bugs-announce mailing list