Commit 7b69f94d authored by Guido van Rossum's avatar Guido van Rossum

Raise ValueError: "unconvertible time" when ctime() returns NULL,

instead of dumping core.
parent e16484a4
...@@ -371,6 +371,10 @@ time_ctime(self, args) ...@@ -371,6 +371,10 @@ time_ctime(self, args)
return NULL; return NULL;
tt = (time_t)dt; tt = (time_t)dt;
p = ctime(&tt); p = ctime(&tt);
if (p == NULL) {
PyErr_SetString(PyExc_ValueError, "unconvertible time");
return NULL;
}
if (p[24] == '\n') if (p[24] == '\n')
p[24] = '\0'; p[24] = '\0';
return PyString_FromString(p); return PyString_FromString(p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment