mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
bpo-32043: New "developer mode": "-X dev" option (#4413)
Add a new "developer mode": new "-X dev" command line option to enable debug checks at runtime. Changes: * Add unit tests for -X dev * test_cmd_line: replace test.support with support. * Fix _PyRuntimeState_Fini(): Use the same memory allocator than _PyRuntimeState_Init(). * Fix _PyMem_GetDefaultRawAllocator()
This commit is contained in:
parent
05cb728d68
commit
ccb0442a33
7 changed files with 110 additions and 25 deletions
|
|
@ -1396,6 +1396,16 @@ pymain_parse_envvars(_PyMain *pymain)
|
|||
if (pymain_init_tracemalloc(pymain) < 0) {
|
||||
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->faulthandler = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue