mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #22117: Fix rounding in _PyTime_FromSecondsObject()
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject() * Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject() * Add unit tests
This commit is contained in:
parent
79644f9c83
commit
992c43fec9
5 changed files with 211 additions and 86 deletions
|
@ -221,7 +221,7 @@ static PyObject *
|
|||
time_sleep(PyObject *self, PyObject *obj)
|
||||
{
|
||||
_PyTime_t secs;
|
||||
if (_PyTime_FromObject(&secs, obj, _PyTime_ROUND_UP))
|
||||
if (_PyTime_FromSecondsObject(&secs, obj, _PyTime_ROUND_UP))
|
||||
return NULL;
|
||||
if (secs < 0) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue