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

@ -85,15 +85,10 @@ static size_t count_reuse = 0;
static void
show_alloc(void)
{
PyObject *xoptions, *value;
_Py_IDENTIFIER(showalloccount);
xoptions = PySys_GetXOptions();
if (xoptions == NULL)
return;
value = _PyDict_GetItemId(xoptions, &PyId_showalloccount);
if (value != Py_True)
PyInterpreterState *interp = PyThreadState_GET()->interp;
if (!inter->core_config.show_alloc_count) {
return;
}
fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n",
count_alloc);