summaryrefslogtreecommitdiff
path: root/Objects/object.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-13 23:46:04 -0700
committerGitHub <noreply@github.com>2017-09-13 23:46:04 -0700
commit93c92f7d1dbb6e7e472f1d0444c6968858113de2 (patch)
tree031230f9b0cf2e8a8ef21f7fc40c4f5f98d20c6c /Objects/object.c
parent13ad3b7a82bf56d803fbe48ee5df6c4b08986c78 (diff)
downloadcpython-git-93c92f7d1dbb6e7e472f1d0444c6968858113de2.tar.gz
bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)
PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/Objects/object.c b/Objects/object.c
index ed8a62a163..74893e38c7 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -29,23 +29,20 @@ _Py_GetRefTotal(void)
return total;
}
-PyObject *
-_PyDebug_XOptionShowRefCount(void)
-{
- PyObject *xoptions = PySys_GetXOptions();
- if (xoptions == NULL)
- return NULL;
-
- _Py_IDENTIFIER(showrefcount);
- return _PyDict_GetItemId(xoptions, &PyId_showrefcount);
-}
-
void
_PyDebug_PrintTotalRefs(void) {
- fprintf(stderr,
- "[%" PY_FORMAT_SIZE_T "d refs, "
- "%" PY_FORMAT_SIZE_T "d blocks]\n",
- _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
+ PyObject *xoptions, *value;
+ _Py_IDENTIFIER(showrefcount);
+
+ xoptions = PySys_GetXOptions();
+ if (xoptions == NULL)
+ return;
+ value = _PyDict_GetItemId(xoptions, &PyId_showrefcount);
+ if (value == Py_True)
+ fprintf(stderr,
+ "[%" PY_FORMAT_SIZE_T "d refs, "
+ "%" PY_FORMAT_SIZE_T "d blocks]\n",
+ _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
}
#endif /* Py_REF_DEBUG */