Eric Smith <e...@trueblade.com> added the comment: Can you try this diff and see if it solves the problem:
Index: Modules/timemodule.c =================================================================== --- Modules/timemodule.c (revision 86848) +++ Modules/timemodule.c (working copy) @@ -639,6 +639,7 @@ PyObject *ot = NULL; time_t tt; char *p; + Py_ssize_t len; if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) return NULL; @@ -657,8 +658,10 @@ PyErr_SetString(PyExc_ValueError, "unconvertible time"); return NULL; } - if (p[24] == '\n') - p[24] = '\0'; + len = strlen(p); + if (len > 0 && p[len-1] == '\n') + /* Remove the trailing newline, if present. */ + p[len-1] = '\0'; return PyUnicode_FromString(p); } ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10563> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com