From 09796f2f142fdb1214f34a3ca917959ecb32a88b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 30 Sep 2021 02:11:41 +0200 Subject: bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629) Add the _PyTime_AsTimespec_clamp() function: similar to _PyTime_AsTimespec(), but clamp to _PyTime_t min/max and don't raise an exception. PyThread_acquire_lock_timed() now uses _PyTime_AsTimespec_clamp() to remove the Py_UNREACHABLE() code path. * Add _PyTime_AsTime_t() function. * Add PY_TIME_T_MIN and PY_TIME_T_MAX constants. * Replace _PyTime_AsTimeval_noraise() with _PyTime_AsTimeval_clamp(). * Add pytime_divide_round_up() function. * Fix integer overflow in pytime_divide(). * Add pytime_divmod() function. --- Modules/selectmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/selectmodule.c') diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 3ecd0c32b3..b71b2c4f6c 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -344,7 +344,7 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, n = 0; break; } - _PyTime_AsTimeval_noraise(timeout, &tv, _PyTime_ROUND_CEILING); + _PyTime_AsTimeval_clamp(timeout, &tv, _PyTime_ROUND_CEILING); /* retry select() with the recomputed timeout */ } } while (1); -- cgit v1.2.1