From 78535706517b3e6bf0c2e594e3c53dbed10c016e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 3 Mar 1998 22:19:10 +0000 Subject: [PATCH] Raise ValueError: "unconvertible time" when ctime() returns NULL, instead of dumping core. --- Modules/timemodule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 1791cf475d..b49bffcbea 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -371,6 +371,10 @@ time_ctime(self, args) return NULL; tt = (time_t)dt; p = ctime(&tt); + if (p == NULL) { + PyErr_SetString(PyExc_ValueError, "unconvertible time"); + return NULL; + } if (p[24] == '\n') p[24] = '\0'; return PyString_FromString(p); -- 2.50.1