summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 89666a4..e8ea661 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -620,6 +620,10 @@ time_asctime(PyObject *self, PyObject *args)
} else if (!gettmarg(tup, &buf) || !checktm(&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);