diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pylifecycle.c | 9 | ||||
-rw-r--r-- | Python/sysmodule.c | 6 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index e9db7f6..715a547 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -702,9 +702,12 @@ Py_FinalizeEx(void) if (Py_GETENV("PYTHONDUMPREFS")) _Py_PrintReferenceAddresses(stderr); #endif /* Py_TRACE_REFS */ -#ifdef PYMALLOC_DEBUG - if (Py_GETENV("PYTHONMALLOCSTATS")) - _PyObject_DebugMallocStats(stderr); +#ifdef WITH_PYMALLOC + if (_PyMem_PymallocEnabled()) { + char *opt = Py_GETENV("PYTHONMALLOCSTATS"); + if (opt != NULL && *opt != '\0') + _PyObject_DebugMallocStats(stderr); + } #endif call_ll_exitfuncs(); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 702e8f0..c5b4ac1 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1151,8 +1151,10 @@ static PyObject * sys_debugmallocstats(PyObject *self, PyObject *args) { #ifdef WITH_PYMALLOC - _PyObject_DebugMallocStats(stderr); - fputc('\n', stderr); + if (_PyMem_PymallocEnabled()) { + _PyObject_DebugMallocStats(stderr); + fputc('\n', stderr); + } #endif _PyObject_DebugTypeStats(stderr); |