diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 00:51:13 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 00:51:13 (GMT) |
commit | ea9c0dd2c27884691f0a0af983fd41d4d818e93f (patch) | |
tree | a8da8821f8fa7c484073538e41b8eb72de384b81 /Modules/_testcapimodule.c | |
parent | 160e819a1d0a01fe79b66bf398c925c0dac0ded1 (diff) | |
download | cpython-ea9c0dd2c27884691f0a0af983fd41d4d818e93f.zip cpython-ea9c0dd2c27884691f0a0af983fd41d4d818e93f.tar.gz cpython-ea9c0dd2c27884691f0a0af983fd41d4d818e93f.tar.bz2 |
Issue #22117: Fix usage of _PyTime_AsTimeval()
Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or
not useful) to raise a Python exception on overflow.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 9abb7cc..128ba09 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -3427,11 +3427,8 @@ test_PyTime_AsTimeval(PyObject *self, PyObject *args) if (check_time_rounding(round) < 0) return NULL; t = _PyTime_FromNanoseconds(ns); - if (_PyTime_AsTimeval(t, &tv, round) < 0) { - PyErr_SetString(PyExc_OverflowError, - "timeout doesn't fit into C timeval"); + if (_PyTime_AsTimeval(t, &tv, round) < 0) return NULL; - } seconds = PyLong_FromLong((PY_LONG_LONG)tv.tv_sec); if (seconds == NULL) |