summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-03 22:19:10 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-03 22:19:10 (GMT)
commit78535706517b3e6bf0c2e594e3c53dbed10c016e (patch)
tree945395be3d0bc385f10346ebee49f5ad40337c27 /Modules
parent1aca4d803dfb32ad3d0690d804a5d1b3afd60064 (diff)
downloadcpython-78535706517b3e6bf0c2e594e3c53dbed10c016e.zip
cpython-78535706517b3e6bf0c2e594e3c53dbed10c016e.tar.gz
cpython-78535706517b3e6bf0c2e594e3c53dbed10c016e.tar.bz2
Raise ValueError: "unconvertible time" when ctime() returns NULL,
instead of dumping core.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 1791cf4..b49bffc 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);