diff options
author | Brett Cannon <brett@python.org> | 2012-04-07 18:59:29 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-04-07 18:59:29 (GMT) |
commit | 8798ad3e1e0647554cb68033c6b25b7b22e2a19d (patch) | |
tree | 7a715970e271407e18fa881841df98eb8e7fa5a9 | |
parent | 014397e981184a0aca27b289a10128b780bc4d13 (diff) | |
download | cpython-8798ad3e1e0647554cb68033c6b25b7b22e2a19d.zip cpython-8798ad3e1e0647554cb68033c6b25b7b22e2a19d.tar.gz cpython-8798ad3e1e0647554cb68033c6b25b7b22e2a19d.tar.bz2 |
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.
-rw-r--r-- | Modules/selectmodule.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 9cb7481..8964b67 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -237,8 +237,12 @@ select_select(PyObject *self, PyObject *args) #endif tv.tv_sec = (long)sec; #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; + tv.tv_usec = tv_usec; #endif if (tv.tv_sec < 0) { PyErr_SetString(PyExc_ValueError, "timeout must be non-negative"); |