]> granicus.if.org Git - python/commit
bpo-32230: Set sys.warnoptions with -X dev (#4820)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 12 Dec 2017 21:59:48 +0000 (22:59 +0100)
committerGitHub <noreply@github.com>
Tue, 12 Dec 2017 21:59:48 +0000 (22:59 +0100)
commit747f48e2e92390c44c72f52a1239959601cde157
tree502e53b129aee7a393ca6d05e4f93751919a5e1b
parentb748e3b2586e44bfc7011b601bce9cc6d16d89f1
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.
12 files changed:
Doc/tools/susp-ignored.csv
Doc/using/cmdline.rst
Doc/whatsnew/3.7.rst
Lib/subprocess.py
Lib/test/test_cmd_line.py
Lib/test/test_warnings/__init__.py
Lib/unittest/test/test_runner.py
Lib/warnings.py
Misc/NEWS.d/next/Core and Builtins/2017-12-06-20-18-34.bpo-32230.PgGQaB.rst [new file with mode: 0644]
Misc/NEWS.d/next/Core and Builtins/2017-12-07-17-22-30.bpo-20361.zQUmbi.rst [new file with mode: 0644]
Modules/main.c
Python/_warnings.c