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:
Victor Stinner 2017-11-20 18:12:22 -08:00 committed by GitHub
parent 09f3a8a124
commit 25420fe290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 57 deletions

View file

@ -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;