mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #13964: signal.sigtimedwait() timeout is now a float instead of a tuple
Add a private API to convert an int or float to a C timespec structure.
This commit is contained in:
parent
1c13f84f55
commit
643cd68ea4
7 changed files with 106 additions and 20 deletions
|
@ -783,16 +783,11 @@ signal_sigtimedwait(PyObject *self, PyObject *args)
|
|||
siginfo_t si;
|
||||
int err;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO:sigtimedwait", &signals, &timeout))
|
||||
if (!PyArg_ParseTuple(args, "OO:sigtimedwait",
|
||||
&signals, &timeout))
|
||||
return NULL;
|
||||
|
||||
if (!PyTuple_Check(timeout) || PyTuple_Size(timeout) != 2) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"sigtimedwait() arg 2 must be a tuple "
|
||||
"(timeout_sec, timeout_nsec)");
|
||||
return NULL;
|
||||
} else if (!PyArg_ParseTuple(timeout, "ll:sigtimedwait",
|
||||
&(buf.tv_sec), &(buf.tv_nsec)))
|
||||
if (_PyTime_ObjectToTimespec(timeout, &buf.tv_sec, &buf.tv_nsec) == -1)
|
||||
return NULL;
|
||||
|
||||
if (buf.tv_sec < 0 || buf.tv_nsec < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue