Browse Source
bpo-32230: Set sys.warnoptions with -X dev (#4820)
bpo-32230: Set sys.warnoptions with -X dev (#4820)
Rather than supporting dev mode directly in the warnings module, this instead adjusts the initialisation code to add an extra 'default' entry to sys.warnoptions when dev mode is enabled. This ensures that dev mode behaves *exactly* as if `-Wdefault` had been passed on the command line, including in the way it interacts with `sys.warnoptions`, and with other command line flags like `-bb`. Fix also bpo-20361: have -b & -bb options take precedence over any other warnings options. Patch written by Nick Coghlan, with minor modifications of Victor Stinner.pull/4822/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 224 additions and 124 deletions
-
3Doc/tools/susp-ignored.csv
-
6Doc/using/cmdline.rst
-
42Doc/whatsnew/3.7.rst
-
18Lib/subprocess.py
-
81Lib/test/test_cmd_line.py
-
15Lib/test/test_warnings/__init__.py
-
2Lib/unittest/test/test_runner.py
-
35Lib/warnings.py
-
3Misc/NEWS.d/next/Core and Builtins/2017-12-06-20-18-34.bpo-32230.PgGQaB.rst
-
4Misc/NEWS.d/next/Core and Builtins/2017-12-07-17-22-30.bpo-20361.zQUmbi.rst
-
66Modules/main.c
-
73Python/_warnings.c
@ -0,0 +1,3 @@ |
|||
`-X dev` now injects a ``'default'`` entry into sys.warnoptions, ensuring |
|||
that it behaves identically to actually passing ``-Wdefault`` at the command |
|||
line. |
|||
@ -0,0 +1,4 @@ |
|||
``-b`` and ``-bb`` now inject ``'default::BytesWarning'`` and |
|||
``error::BytesWarning`` entries into ``sys.warnoptions``, ensuring that they |
|||
take precedence over any other warning filters configured via the ``-W`` |
|||
option or the ``PYTHONWARNINGS`` environment variable. |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue