summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2014-11-20 11:39:37 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2014-11-20 11:39:37 (GMT)
commitd600951748d7a19cdb3e58a376c51ed804b630e6 (patch)
treec28038ac0a6f2dbab55ceee1217ab8efb61cd64d /Objects/object.c
parent66fb349d6ca325f54f2f89986146ddb8f3bcbef4 (diff)
downloadcpython-d600951748d7a19cdb3e58a376c51ed804b630e6.zip
cpython-d600951748d7a19cdb3e58a376c51ed804b630e6.tar.gz
cpython-d600951748d7a19cdb3e58a376c51ed804b630e6.tar.bz2
Issue #22869: Split pythonrun into two modules
- interpreter startup and shutdown code moved to a new pylifecycle.c module - Py_OptimizeFlag moved into the new module with the other global flags
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index b9ae23a..42cbbcd 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -33,6 +33,22 @@ _Py_GetRefTotal(void)
total -= o->ob_refcnt;
return total;
}
+
+void
+_PyDebug_PrintTotalRefs(void) {
+ 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 */
/* Object allocation routines used by NEWOBJ and NEWVAROBJ macros.