summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index abc43a2..32bdaf7 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -643,6 +643,10 @@ time_asctime(PyObject *self, PyObject *args)
} else if (!gettmarg(tup, &buf))
return NULL;
p = asctime(&buf);
+ if (p == NULL) {
+ PyErr_SetString(PyExc_ValueError, "invalid time");
+ return NULL;
+ }
if (p[24] == '\n')
p[24] = '\0';
return PyUnicode_FromString(p);