summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-18 00:41:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-18 00:41:44 (GMT)
commit2c085604b761e56ea6635ca6158356c9d46fea50 (patch)
treeae759c52225fa675fc2dad7c6977e3cd9991ddb3
parent7422b22e5e2b5462908b4f5f45574ef2de7961c6 (diff)
downloadcpython-2c085604b761e56ea6635ca6158356c9d46fea50.zip
cpython-2c085604b761e56ea6635ca6158356c9d46fea50.tar.gz
cpython-2c085604b761e56ea6635ca6158356c9d46fea50.tar.bz2
Fix error handling in timemodule.c
-rw-r--r--Modules/timemodule.c8
1 files 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);
}