diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-21 02:12:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 02:12:22 (GMT) |
commit | 25420fe290b98171e6d30edf9350292c21ef700e (patch) | |
tree | 265d725ef6c341501f38873266c91e7461fd0364 /Modules/main.c | |
parent | 09f3a8a1249308a104a89041d82fe99e6c087043 (diff) | |
download | cpython-25420fe290b98171e6d30edf9350292c21ef700e.zip cpython-25420fe290b98171e6d30edf9350292c21ef700e.tar.gz cpython-25420fe290b98171e6d30edf9350292c21ef700e.tar.bz2 |
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
Diffstat (limited to 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/main.c b/Modules/main.c index 70c1c3d..e5e4f33 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -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; |