summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-11-21 02:12:22 (GMT)
committerGitHub <noreply@github.com>2017-11-21 02:12:22 (GMT)
commit25420fe290b98171e6d30edf9350292c21ef700e (patch)
tree265d725ef6c341501f38873266c91e7461fd0364 /Python/pythonrun.c
parent09f3a8a1249308a104a89041d82fe99e6c087043 (diff)
downloadcpython-25420fe290b98171e6d30edf9350292c21ef700e.zip
cpython-25420fe290b98171e6d30edf9350292c21ef700e.tar.gz
cpython-25420fe290b98171e6d30edf9350292c21ef700e.tar.bz2
bpo-32030: Add more options to _PyCoreConfig (#4485)
Py_Main() now handles two more -X options: * -X showrefcount: new _PyCoreConfig.show_ref_count field * -X showalloccount: new _PyCoreConfig.show_alloc_count field
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 90b29cb..b528575 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -91,6 +91,9 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *
int ret, err;
PyCompilerFlags local_flags;
int nomem_count = 0;
+#ifdef Py_REF_DEBUG
+ int show_ref_count = PyThreadState_GET()->interp->core_config.show_ref_count;
+#endif
filename = PyUnicode_DecodeFSDefault(filename_str);
if (filename == NULL) {
@@ -134,8 +137,9 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *
nomem_count = 0;
}
#ifdef Py_REF_DEBUG
- if (_PyDebug_XOptionShowRefCount() == Py_True)
+ if (show_ref_count) {
_PyDebug_PrintTotalRefs();
+ }
#endif
} while (ret != E_EOF);
Py_DECREF(filename);