mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-32030: Add more options to _PyCoreConfig (#4485)
Py_Main() now handles two more -X options: * -X showrefcount: new _PyCoreConfig.show_ref_count field * -X showalloccount: new _PyCoreConfig.show_alloc_count field
This commit is contained in:
parent
09f3a8a124
commit
25420fe290
9 changed files with 41 additions and 57 deletions
|
@ -1384,6 +1384,14 @@ pymain_parse_envvars(_PyMain *pymain)
|
|||
}
|
||||
core_config->allocator = Py_GETENV("PYTHONMALLOC");
|
||||
|
||||
/* -X options */
|
||||
if (pymain_get_xoption(pymain, L"showrefcount")) {
|
||||
core_config->show_ref_count = 1;
|
||||
}
|
||||
if (pymain_get_xoption(pymain, L"showalloccount")) {
|
||||
core_config->show_alloc_count = 1;
|
||||
}
|
||||
|
||||
/* More complex options: env var and/or -X option */
|
||||
if (pymain_get_env_var("PYTHONFAULTHANDLER")
|
||||
|| pymain_get_xoption(pymain, L"faulthandler")) {
|
||||
|
@ -1391,7 +1399,7 @@ pymain_parse_envvars(_PyMain *pymain)
|
|||
}
|
||||
if (pymain_get_env_var("PYTHONPROFILEIMPORTTIME")
|
||||
|| pymain_get_xoption(pymain, L"importtime")) {
|
||||
core_config->importtime = 1;
|
||||
core_config->import_time = 1;
|
||||
}
|
||||
if (pymain_init_tracemalloc(pymain) < 0) {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue