Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(954)

Unified Diff: Modules/_randommodule.c

Issue 13847: Catch time(), ftime(), localtime() and clock() errors
Patch Set: Created 1 year, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Modules/_datetimemodule.c ('k') | Modules/_threadmodule.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -223,7 +223,12 @@ random_seed(RandomObject *self, PyObject
if (arg == NULL || arg == Py_None) {
time_t now;
+ errno = 0;
time(&now);
+ if (now == (time_t)-1 && errno != 0) {
+ PyErr_SetFromErrno(PyExc_IOError);
+ return NULL;
+ }
init_genrand(self, (unsigned long)now);
Py_INCREF(Py_None);
return Py_None;
« no previous file with comments | « Modules/_datetimemodule.c ('k') | Modules/_threadmodule.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7