summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-04-28 11:08:27 -0400
committerR David Murray <rdmurray@bitdance.com>2013-04-28 11:08:27 -0400
commitae3dbb9b279701ee8378123ac74f2f5d59b2c377 (patch)
tree30e8b2105a17dc98a78e98a0730d3235557a8c9c /Python/pythonrun.c
parent62e6455f78c85d5fa1c983a499ab089bd22e2c4e (diff)
parent519ad453b3624294a5c7664208d3a4f8ac353cdc (diff)
downloadcpython-ae3dbb9b279701ee8378123ac74f2f5d59b2c377.tar.gz
Merge #7152: Clarify that ProxyHandler is added only if proxy settings are detected.
Behavior confirmation and initial patch by Jessica McKellar.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index dd32017574..0cd695f36e 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -35,12 +35,30 @@
#define PATH_MAX MAXPATHLEN
#endif
+#ifdef Py_REF_DEBUG
+static
+void _print_total_refs(void) {
+ PyObject *xoptions, *key, *value;
+ xoptions = PySys_GetXOptions();
+ if (xoptions == NULL)
+ return;
+ key = PyUnicode_FromString("showrefcount");
+ if (key == NULL)
+ return;
+ value = PyDict_GetItem(xoptions, key);
+ Py_DECREF(key);
+ if (value == Py_True)
+ fprintf(stderr,
+ "[%" PY_FORMAT_SIZE_T "d refs, "
+ "%" PY_FORMAT_SIZE_T "d blocks]\n",
+ _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
+}
+#endif
+
#ifndef Py_REF_DEBUG
#define PRINT_TOTAL_REFS()
#else /* Py_REF_DEBUG */
-#define PRINT_TOTAL_REFS() fprintf(stderr, \
- "[%" PY_FORMAT_SIZE_T "d refs]\n", \
- _Py_GetRefTotal())
+#define PRINT_TOTAL_REFS() _print_total_refs()
#endif
#ifdef __cplusplus