This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Gerrit.Holl, eric.smith
Date 2010-11-28.16:17:31
SpamBayes Score 1.2087585e-05
Marked as misclassified No
Message-id <1290961054.88.0.0564889572506.issue10563@psf.upfronthosting.co.za>
In-reply-to
Content
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);
 }
History
Date User Action Args
2010-11-28 16:17:34eric.smithsetrecipients: + eric.smith, Gerrit.Holl
2010-11-28 16:17:34eric.smithsetmessageid: <1290961054.88.0.0564889572506.issue10563@psf.upfronthosting.co.za>
2010-11-28 16:17:31eric.smithlinkissue10563 messages
2010-11-28 16:17:31eric.smithcreate