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: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78535706517b3e6bf0c2e594e3c53dbed10c016e;p=thirdparty%2FPython%2Fcpython.git Raise ValueError: "unconvertible time" when ctime() returns NULL, instead of dumping core. --- diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 1791cf475d04..b49bffcbea35 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);