From: Guido van Rossum Date: Tue, 3 Mar 1998 22:19:10 +0000 (+0000) Subject: Raise ValueError: "unconvertible time" when ctime() returns NULL, X-Git-Tag: v1.5.1~522 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78535706517b3e6bf0c2e594e3c53dbed10c016e;p=python Raise ValueError: "unconvertible time" when ctime() returns NULL, instead of dumping core. --- 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);