bpo-32089: Fix warnings filters in dev mode (#4482)

The developer mode (-X dev) now creates all default warnings filters
to order filters in the correct order to always show ResourceWarning
and make BytesWarning depend on the -b option.

Write a functional test to make sure that ResourceWarning is logged
twice at the same location in the developer mode.

Add a new 'dev_mode' field to _PyCoreConfig.
This commit is contained in:
Victor Stinner 2017-11-20 17:32:40 -08:00 committed by GitHub
parent f39b674876
commit 09f3a8a124
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 39 deletions

View file

@ -1397,14 +1397,9 @@ pymain_parse_envvars(_PyMain *pymain)
return -1;
}
if (pymain_get_xoption(pymain, L"dev")) {
/* "python3 -X dev ..." behaves
as "PYTHONMALLOC=debug python3 -Wd -X faulthandler ..." */
core_config->allocator = "debug";
if (pymain_optlist_append(pymain, &pymain->cmdline.warning_options,
L"default") < 0) {
return -1;
}
core_config->dev_mode = 1;
core_config->faulthandler = 1;
core_config->allocator = "debug";
}
return 0;
}