diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-05-31 16:19:50 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-05-31 16:19:50 (GMT) |
commit | 4af32b3d67bf013b6dcce3b827365d187a0e2973 (patch) | |
tree | 3ef3994f83ab337c896e99a55b2fe30f9c2b8459 | |
parent | 7696ed7b926dd73700ff9972d7a47beb7ec13191 (diff) | |
download | cpython-4af32b3d67bf013b6dcce3b827365d187a0e2973.zip cpython-4af32b3d67bf013b6dcce3b827365d187a0e2973.tar.gz cpython-4af32b3d67bf013b6dcce3b827365d187a0e2973.tar.bz2 |
Change format_ctime() to return unicode (i.e.
date.ctime() and datetime.ctime() return unicode now).
-rw-r--r-- | Modules/datetimemodule.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 4cc9412..835af61 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -1083,14 +1083,12 @@ format_ctime(PyDateTime_Date *date, int hours, int minutes, int seconds) "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - char buffer[128]; int wday = weekday(GET_YEAR(date), GET_MONTH(date), GET_DAY(date)); - PyOS_snprintf(buffer, sizeof(buffer), "%s %s %2d %02d:%02d:%02d %04d", - DayNames[wday], MonthNames[GET_MONTH(date) - 1], - GET_DAY(date), hours, minutes, seconds, - GET_YEAR(date)); - return PyString_FromString(buffer); + return PyUnicode_FromFormat("%s %s %2d %02d:%02d:%02d %04d", + DayNames[wday], MonthNames[GET_MONTH(date)-1], + GET_DAY(date), hours, minutes, seconds, + GET_YEAR(date)); } /* Add an hours & minutes UTC offset string to buf. buf has no more than |