diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 02:51:13 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 02:51:13 +0200 |
commit | e86873f59ff36f88f82bc885cf7bc052dee22a15 (patch) | |
tree | 96a76fc31173fc8322681ce4fe5832d263d27cb2 /Include/pytime.h | |
parent | 62946f3e658f38509b31b4f1e0c8ad7833d77680 (diff) | |
download | cpython-e86873f59ff36f88f82bc885cf7bc052dee22a15.tar.gz |
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 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index b8727748a0..f14e1fc6fd 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -94,11 +94,17 @@ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); /* Convert a timestamp to a timeval structure (microsecond resolution). tv_usec is always positive. - Return -1 if the conversion overflowed, return 0 on success. */ + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); +/* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */ +PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t, + struct timeval *tv, + _PyTime_round_t round); + #if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) /* Convert a timestamp to a timespec structure (nanosecond resolution). tv_nsec is always positive. |