diff options
author | Victor Stinner <vstinner@python.org> | 2021-09-30 00:11:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 00:11:41 (GMT) |
commit | 09796f2f142fdb1214f34a3ca917959ecb32a88b (patch) | |
tree | 28ec5f6d88dbaaff416418964ce430221b7cacd0 /Modules/socketmodule.c | |
parent | 8d3e7eff0936926554db6162c992af5829dc8160 (diff) | |
download | cpython-09796f2f142fdb1214f34a3ca917959ecb32a88b.zip cpython-09796f2f142fdb1214f34a3ca917959ecb32a88b.tar.gz cpython-09796f2f142fdb1214f34a3ca917959ecb32a88b.tar.bz2 |
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 83f05b7..f474869 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -758,7 +758,7 @@ internal_select(PySocketSockObject *s, int writing, _PyTime_t interval, Py_END_ALLOW_THREADS; #else if (interval >= 0) { - _PyTime_AsTimeval_noraise(interval, &tv, _PyTime_ROUND_CEILING); + _PyTime_AsTimeval_clamp(interval, &tv, _PyTime_ROUND_CEILING); tvp = &tv; } else |