diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 20:24:58 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-04-17 20:24:58 (GMT) |
commit | 245bbee0d5ba93cb7edecb21173da82afb66ded6 (patch) | |
tree | 54ad95a497b17c67f19976cf97e1ac4351928fbb /Modules | |
parent | b147f60a3840e59ded58a7cb4a9db1305743302a (diff) | |
parent | 0471ac3d80cb9acdfc82b053145477f5f1e7c6f1 (diff) | |
download | cpython-245bbee0d5ba93cb7edecb21173da82afb66ded6.zip cpython-245bbee0d5ba93cb7edecb21173da82afb66ded6.tar.gz cpython-245bbee0d5ba93cb7edecb21173da82afb66ded6.tar.bz2 |
Merge.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 10 | ||||
-rw-r--r-- | Modules/signalmodule.c | 6 | ||||
-rw-r--r-- | Modules/timemodule.c | 6 |
3 files changed, 18 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6830684..1149856 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4507,6 +4507,8 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs) } if (times && (times != Py_None)) { + time_t a_sec, m_sec; + long a_nsec, m_nsec; if (!PyTuple_CheckExact(times) || (PyTuple_Size(times) != 2)) { PyErr_SetString(PyExc_TypeError, "utime: 'times' must be either" @@ -4515,11 +4517,15 @@ posix_utime(PyObject *self, PyObject *args, PyObject *kwargs) } utime.now = 0; if (_PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 0), - &utime.atime_s, &utime.atime_ns) == -1 || + &a_sec, &a_nsec) == -1 || _PyTime_ObjectToTimespec(PyTuple_GET_ITEM(times, 1), - &utime.mtime_s, &utime.mtime_ns) == -1) { + &m_sec, &m_nsec) == -1) { goto exit; } + utime.atime_s = a_sec; + utime.atime_ns = a_nsec; + utime.mtime_s = m_sec; + utime.mtime_ns = m_nsec; } else if (ns) { if (!PyTuple_CheckExact(ns) || (PyTuple_Size(ns) != 2)) { diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 8b6c1c2..dd55c10 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -779,14 +779,18 @@ signal_sigtimedwait(PyObject *self, PyObject *args) struct timespec buf; sigset_t set; siginfo_t si; + time_t tv_sec; + long tv_nsec; int err; if (!PyArg_ParseTuple(args, "OO:sigtimedwait", &signals, &timeout)) return NULL; - if (_PyTime_ObjectToTimespec(timeout, &buf.tv_sec, &buf.tv_nsec) == -1) + if (_PyTime_ObjectToTimespec(timeout, &tv_sec, &tv_nsec) == -1) return NULL; + buf.tv_sec = tv_sec; + buf.tv_nsec = tv_nsec; if (buf.tv_sec < 0 || buf.tv_nsec < 0) { PyErr_SetString(PyExc_ValueError, "timeout must be non-negative"); diff --git a/Modules/timemodule.c b/Modules/timemodule.c index d5ffdcc..429215f 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -185,14 +185,18 @@ time_clock_settime(PyObject *self, PyObject *args) { int clk_id; PyObject *obj; + time_t tv_sec; + long tv_nsec; struct timespec tp; int ret; if (!PyArg_ParseTuple(args, "iO:clock_settime", &clk_id, &obj)) return NULL; - if (_PyTime_ObjectToTimespec(obj, &tp.tv_sec, &tp.tv_nsec) == -1) + if (_PyTime_ObjectToTimespec(obj, &tv_sec, &tv_nsec) == -1) return NULL; + tp.tv_sec = tv_sec; + tp.tv_nsec = tv_nsec; ret = clock_settime((clockid_t)clk_id, &tp); if (ret != 0) { |