Mercurial > cpython-lru_cache-weakref
diff Modules/timemodule.c @ 7532:bf236fbf11da legacy-trunk
Raise ValueError: "unconvertible time" when ctime() returns NULL,
instead of dumping core.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 03 Mar 1998 22:19:10 +0000 |
| parents | bbad2c684ad7 |
| children | 7e7d6b1b8a4b |
line wrap: on
line diff
--- a/Modules/timemodule.c Tue Mar 03 22:10:18 1998 +0000 +++ b/Modules/timemodule.c Tue Mar 03 22:19:10 1998 +0000 @@ -371,6 +371,10 @@ 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);
