[Python-3000-checkins] r55710 - python/branches/py3k-struni/Modules/datetimemodule.c

walter.doerwald python-3000-checkins at python.org
Thu May 31 18:19:56 CEST 2007


Author: walter.doerwald
Date: Thu May 31 18:19:50 2007
New Revision: 55710

Modified:
   python/branches/py3k-struni/Modules/datetimemodule.c
Log:
Change format_ctime() to return unicode (i.e.
date.ctime() and datetime.ctime() return unicode now).


Modified: python/branches/py3k-struni/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/datetimemodule.c	(original)
+++ python/branches/py3k-struni/Modules/datetimemodule.c	Thu May 31 18:19:50 2007
@@ -1083,14 +1083,12 @@
 		"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


More information about the Python-3000-checkins mailing list