From 2c085604b761e56ea6635ca6158356c9d46fea50 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 18 Jan 2012 01:41:44 +0100 Subject: Fix error handling in timemodule.c --- Modules/timemodule.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 89a41ce..46b8e9a 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -128,8 +128,10 @@ time_clock_gettime(PyObject *self, PyObject *args) return NULL; ret = clock_gettime((clockid_t)clk_id, &tp); - if (ret != 0) + if (ret != 0) { PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); } @@ -152,8 +154,10 @@ time_clock_getres(PyObject *self, PyObject *args) return NULL; ret = clock_getres((clockid_t)clk_id, &tp); - if (ret != 0) + if (ret != 0) { PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); } -- cgit v0.12