Author vstinner
Recipients vstinner
Date 2019-09-29.22:54:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569797677.63.0.958144082702.issue38317@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2019-09-29 22:54:37vstinnersetrecipients: + vstinner
2019-09-29 22:54:37vstinnersetmessageid: <1569797677.63.0.958144082702.issue38317@roundup.psfhosted.org>
2019-09-29 22:54:37vstinnerlinkissue38317 messages
2019-09-29 22:54:37vstinnercreate