comparison Python/pythonrun.c @ 82956:367167f93c30

#17323: The "[X refs, Y blocks]" printed by debug builds has been disabled by default. It can be re-enabled with the `-X showrefcount` option.
author Ezio Melotti <ezio.melotti@gmail.com>
date Tue, 26 Mar 2013 01:59:56 +0200
parents c40f4c19d20b
children 6eacc6c134a5
comparison
equal deleted inserted replaced
82954:5022ee7e13a2 82956:367167f93c30
33 #undef BYTE 33 #undef BYTE
34 #include "windows.h" 34 #include "windows.h"
35 #define PATH_MAX MAXPATHLEN 35 #define PATH_MAX MAXPATHLEN
36 #endif 36 #endif
37 37
38 #ifdef Py_REF_DEBUG
39 void _print_total_refs() {
40 PyObject *xoptions, *key, *value;
41 xoptions = PySys_GetXOptions();
42 if (xoptions == NULL)
43 return;
44 key = PyUnicode_FromString("showrefcount");
45 if (key == NULL)
46 return;
47 value = PyDict_GetItem(xoptions, key);
48 Py_DECREF(key);
49 if (value == Py_True)
50 fprintf(stderr,
51 "[%" PY_FORMAT_SIZE_T "d refs, "
52 "%" PY_FORMAT_SIZE_T "d blocks]\n",
53 _Py_GetRefTotal(), _Py_GetAllocatedBlocks());
54 }
55 #endif
56
38 #ifndef Py_REF_DEBUG 57 #ifndef Py_REF_DEBUG
39 #define PRINT_TOTAL_REFS() 58 #define PRINT_TOTAL_REFS()
40 #else /* Py_REF_DEBUG */ 59 #else /* Py_REF_DEBUG */
41 #define PRINT_TOTAL_REFS() fprintf(stderr, \ 60 #define PRINT_TOTAL_REFS() _print_total_refs()
42 "[%" PY_FORMAT_SIZE_T "d refs, " \
43 "%" PY_FORMAT_SIZE_T "d blocks]\n", \
44 _Py_GetRefTotal(), _Py_GetAllocatedBlocks())
45 #endif 61 #endif
46 62
47 #ifdef __cplusplus 63 #ifdef __cplusplus
48 extern "C" { 64 extern "C" {
49 #endif 65 #endif