summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-05-05 10:15:19 (GMT)
committerGitHub <noreply@github.com>2024-05-05 10:15:19 (GMT)
commitaa61f8bfcf2584dd8345f1f9a07e240100b79192 (patch)
treedb196e9316a20ff332290c56b60c38a6b533fae6 /Python/import.c
parentc7c9b913c01afb8d2ff4048f82155969f7ef75b1 (diff)
downloadcpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.zip
cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.tar.gz
cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.tar.bz2
gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)
Use the new public Raw functions: * _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw() * _PyTime_TimeUnchecked() with PyTime_TimeRaw() * _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw() Remove internal functions: * _PyTime_PerfCounterUnchecked() * _PyTime_TimeUnchecked() * _PyTime_MonotonicUnchecked()
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/import.c b/Python/import.c
index fa0e548..3327707 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -13,7 +13,7 @@
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_sysmodule.h" // _PySys_Audit()
-#include "pycore_time.h" // _PyTime_PerfCounterUnchecked()
+#include "pycore_time.h" // _PyTime_AsMicroseconds()
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
#include "marshal.h" // PyMarshal_ReadObjectFromString()
@@ -3468,7 +3468,8 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
#undef header
import_level++;
- t1 = _PyTime_PerfCounterUnchecked();
+ // ignore error: don't block import if reading the clock fails
+ (void)PyTime_PerfCounterRaw(&t1);
accumulated = 0;
}
@@ -3483,7 +3484,9 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
mod != NULL);
if (import_time) {
- PyTime_t cum = _PyTime_PerfCounterUnchecked() - t1;
+ PyTime_t t2;
+ (void)PyTime_PerfCounterRaw(&t2);
+ PyTime_t cum = t2 - t1;
import_level--;
fprintf(stderr, "import time: %9ld | %10ld | %*s%s\n",