[issue7413] datetime.datetime.isoformat truncation problem

2009-12-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Fixed with r77122 (trunk) and r77125 (release26-maint). py3k uses PyUnicode_FromFormat directly and does not have this problem. I merged the test there nonetheless. -- resolution: -> fixed status: open -> closed

[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Eric Smith
Eric Smith added the comment: I think you need to put an assert before the line with bufflen-x, since that's the calculation you're trying to ensure doesn't underflow. And I guess that technically you should inspect the result of PyOS_snprintf for an error, but given that we know the buffer size

[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Here is a new patch against a fresh trunk, and with the suggested changes: they indeed make the code more consistent with other parts. -- keywords: +needs review Added file: http://bugs.python.org/file15433/isoformat-2.patch

[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Eric Smith
Eric Smith added the comment: The patch looks okay to me, and works on 2.7. Although it's slightly out of date with respect to line numbers, it still applies cleanly. My trivial suggestions are that I'd replace: x += PyOS_snprintf(buffer + 8, bufflen - 8, ".%06d", us); with x += PyOS_snprintf(b

[issue7413] datetime.datetime.isoformat truncation problem

2009-12-01 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Here is a test + fix. -- assignee: -> amaury.forgeotdarc keywords: +patch nosy: +amaury.forgeotdarc Added file: http://bugs.python.org/file15424/isoformat.patch ___ Python tracker

[issue7413] datetime.datetime.isoformat truncation problem

2009-11-30 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone : Passing NUL as the separator to isoformat drops the time part of the result entirely: >>> import datetime >>> datetime.datetime.today().isoformat() '2009-11-30T20:57:37.918750' >>> datetime.datetime.today().isoformat('x') '2009-11-30x20:57:39.902573' >>>