summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c7
-rw-r--r--Python/pylifecycle.c9
-rw-r--r--Python/pythonrun.c6
3 files changed, 11 insertions, 11 deletions
diff --git a/Python/import.c b/Python/import.c
index fef6398..d2ed785 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1674,8 +1674,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
}
}
else {
- /* 1 -- true, 0 -- false, -1 -- not initialized */
- int importtime = interp->core_config.importtime;
+ int import_time = interp->core_config.import_time;
static int import_level;
static _PyTime_t accumulated;
@@ -1686,7 +1685,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
* Anyway, importlib._find_and_load is much slower than
* _PyDict_GetItemIdWithError().
*/
- if (importtime) {
+ if (import_time) {
static int header = 1;
if (header) {
fputs("import time: self [us] | cumulative | imported package\n",
@@ -1712,7 +1711,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
PyDTrace_IMPORT_FIND_LOAD_DONE(PyUnicode_AsUTF8(abs_name),
mod != NULL);
- if (importtime) {
+ if (import_time) {
_PyTime_t cum = _PyTime_GetPerfCounter() - t1;
import_level--;
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 14fe75e..36fcf61 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1101,10 +1101,6 @@ Py_FinalizeEx(void)
/* nothing */;
#endif
-#ifdef Py_REF_DEBUG
- PyObject *showrefcount = _PyDebug_XOptionShowRefCount();
-#endif
-
/* Destroy all modules */
PyImport_Cleanup();
@@ -1153,8 +1149,9 @@ Py_FinalizeEx(void)
_PyHash_Fini();
#ifdef Py_REF_DEBUG
- if (showrefcount == Py_True)
- _PyDebug_PrintTotalRefs();
+ if (interp->core_config.show_ref_count) {
+ _PyDebug_PrintTotalRefs();
+ }
#endif
#ifdef Py_TRACE_REFS
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);