diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-04-29 23:48:03 -0700 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-04-29 23:48:03 -0700 |
commit | d94b4e91b81d0421dc759619fa5e8d4ca008c3e8 (patch) | |
tree | 81c4dd2d9e53d5a03490fa7754e5cb1bd88c248e /Python/pythonrun.c | |
parent | 8ecf4d2d044e467139d85d0c426bae453e82d4cb (diff) | |
parent | 984bb3552a570a3c59c0529c6d83d3248e56e461 (diff) | |
download | cpython-d94b4e91b81d0421dc759619fa5e8d4ca008c3e8.tar.gz |
* Fix PART of issue 17192 for 3.4 - reapply the issue11729 patch
that was undone in the merge fun from upstream which already
had it in 3.0.13.
* Add the missing update to libffi.info.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index ee6071e631..b92a8bd9b4 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 |