mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-37205: time.time() cannot fail with fatal error (GH-23314)
time.time(), time.perf_counter() and time.monotonic() functions can no longer fail with a Python fatal error, instead raise a regular Python exception on failure. Remove _PyTime_Init(): don't check system, monotonic and perf counter clocks at startup anymore. On error, _PyTime_GetSystemClock(), _PyTime_GetMonotonicClock() and _PyTime_GetPerfCounter() now silently ignore the error and return 0. They cannot fail with a Python fatal error anymore. Add py_mach_timebase_info() and win_perf_counter_frequency() sub-functions.
This commit is contained in:
parent
5909a494cd
commit
ae6cd7cfda
5 changed files with 228 additions and 158 deletions
|
|
@ -763,12 +763,6 @@ pycore_interp_init(PyThreadState *tstate)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (_Py_IsMainInterpreter(tstate)) {
|
||||
if (_PyTime_Init() < 0) {
|
||||
return _PyStatus_ERR("can't initialize time");
|
||||
}
|
||||
}
|
||||
|
||||
status = _PySys_Create(tstate, &sysmod);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue