mirror of
https://github.com/python/cpython.git
synced 2025-01-21 07:55:16 +08:00
struct timeval.tv_usec is 4 bytes on 64-bit OS X as it should be, but
is defined as an int while everyone else expects a long regardless of length.
This commit is contained in:
parent
014397e981
commit
8798ad3e1e
@ -237,8 +237,12 @@ select_select(PyObject *self, PyObject *args)
|
|||||||
#endif
|
#endif
|
||||||
tv.tv_sec = (long)sec;
|
tv.tv_sec = (long)sec;
|
||||||
#else
|
#else
|
||||||
if (_PyTime_ObjectToTimeval(tout, &tv.tv_sec, &tv.tv_usec) == -1)
|
/* 64-bit OS X has struct timeval.tv_usec as an int (and thus still 4
|
||||||
|
bytes as required), but no longer defined by a long. */
|
||||||
|
long tv_usec = tv.tv_usec;
|
||||||
|
if (_PyTime_ObjectToTimeval(tout, &tv.tv_sec, &tv_usec) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
tv.tv_usec = tv_usec;
|
||||||
#endif
|
#endif
|
||||||
if (tv.tv_sec < 0) {
|
if (tv.tv_sec < 0) {
|
||||||
PyErr_SetString(PyExc_ValueError, "timeout must be non-negative");
|
PyErr_SetString(PyExc_ValueError, "timeout must be non-negative");
|
||||||
|
Loading…
Reference in New Issue
Block a user