]> granicus.if.org Git - python/commitdiff
Raise ValueError: "unconvertible time" when ctime() returns NULL,
authorGuido van Rossum <guido@python.org>
Tue, 3 Mar 1998 22:19:10 +0000 (22:19 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 3 Mar 1998 22:19:10 +0000 (22:19 +0000)
instead of dumping core.

Modules/timemodule.c

index 1791cf475d04afc57df9509f6db7a1f687e06e0b..b49bffcbea350c2461cd15554764ed845b90a2d2 100644 (file)
@@ -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);