]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix error handling in timemodule.c
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 18 Jan 2012 00:41:44 +0000 (01:41 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 18 Jan 2012 00:41:44 +0000 (01:41 +0100)
Modules/timemodule.c

index 89a41ceb0f63f31af01b8963a0ef0c1f1878c9e1..46b8e9adff0dea7542657cd2a7abc6ce323023f2 100644 (file)
@@ -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);
 }