diff options
| author | Guido van Rossum <guido@python.org> | 1998-03-03 22:19:10 +0000 |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1998-03-03 22:19:10 +0000 |
| commit | 78535706517b3e6bf0c2e594e3c53dbed10c016e (patch) | |
| tree | 945395be3d0bc385f10346ebee49f5ad40337c27 | |
| parent | 1aca4d803dfb32ad3d0690d804a5d1b3afd60064 (diff) | |
| download | cpython-git-78535706517b3e6bf0c2e594e3c53dbed10c016e.tar.gz | |
Raise ValueError: "unconvertible time" when ctime() returns NULL,
instead of dumping core.
| -rw-r--r-- | Modules/timemodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
