summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-14 07:35:58 (GMT)
committerGitHub <noreply@github.com>2017-09-14 07:35:58 (GMT)
commitdae0276bb6bc7281d59fb0b8f1aab31634ee80dc (patch)
treed36e7b49ee6ef1cdb2a2384be568c8d28a7b0bb0 /Objects
parent93c92f7d1dbb6e7e472f1d0444c6968858113de2 (diff)
downloadcpython-dae0276bb6bc7281d59fb0b8f1aab31634ee80dc.zip
cpython-dae0276bb6bc7281d59fb0b8f1aab31634ee80dc.tar.gz
cpython-dae0276bb6bc7281d59fb0b8f1aab31634ee80dc.tar.bz2
bpo-30860: Fix a refleak. (#3567)
Resolves bpo-31420. (This was accidentally reverted when in #3565.)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 74893e3..ed8a62a 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -29,20 +29,23 @@ _Py_GetRefTotal(void)
return total;
}
-void
-_PyDebug_PrintTotalRefs(void) {
- PyObject *xoptions, *value;
+PyObject *
+_PyDebug_XOptionShowRefCount(void)
+{
+ PyObject *xoptions = PySys_GetXOptions();
+ if (xoptions == NULL)
+ return NULL;
+
_Py_IDENTIFIER(showrefcount);
+ return _PyDict_GetItemId(xoptions, &PyId_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());
+void
+_PyDebug_PrintTotalRefs(void) {
+ fprintf(stderr,
+ "[%" PY_FORMAT_SIZE_T "d refs, "
+ "%" PY_FORMAT_SIZE_T "d blocks]\n",
+ _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
}
#endif /* Py_REF_DEBUG */