[Python-checkins] r52072 - in python/trunk: Lib/test/test_datetime.py Misc/NEWS Modules/datetimemodule.c

georg.brandl python-checkins at python.org
Sat Sep 30 13:17:35 CEST 2006


Author: georg.brandl
Date: Sat Sep 30 13:17:34 2006
New Revision: 52072

Modified:
   python/trunk/Lib/test/test_datetime.py
   python/trunk/Misc/NEWS
   python/trunk/Modules/datetimemodule.c
Log:
Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.


Modified: python/trunk/Lib/test/test_datetime.py
==============================================================================
--- python/trunk/Lib/test/test_datetime.py	(original)
+++ python/trunk/Lib/test/test_datetime.py	Sat Sep 30 13:17:34 2006
@@ -844,6 +844,7 @@
         t = self.theclass(2005, 3, 2)
         self.assertEqual(t.strftime("m:%m d:%d y:%y"), "m:03 d:02 y:05")
         self.assertEqual(t.strftime(""), "") # SF bug #761337
+        self.assertEqual(t.strftime('x'*1000), 'x'*1000) # SF bug #1556784
 
         self.assertRaises(TypeError, t.strftime) # needs an arg
         self.assertRaises(TypeError, t.strftime, "one", "two") # too many args

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sat Sep 30 13:17:34 2006
@@ -106,6 +106,9 @@
 Extension Modules
 -----------------
 
+- Bug #1556784: allow format strings longer than 127 characters in
+  datetime's strftime function.
+
 - Fix itertools.count(n) to work with negative numbers again.
 
 - RLIMIT_SBSIZE was added to the resource module where available.

Modified: python/trunk/Modules/datetimemodule.c
==============================================================================
--- python/trunk/Modules/datetimemodule.c	(original)
+++ python/trunk/Modules/datetimemodule.c	Sat Sep 30 13:17:34 2006
@@ -1149,9 +1149,9 @@
 
 	PyObject *newfmt = NULL;	/* py string, the output format */
 	char *pnew;	/* pointer to available byte in output format */
-	char totalnew;	/* number bytes total in output format buffer,
+	int totalnew;	/* number bytes total in output format buffer,
 			   exclusive of trailing \0 */
-	char usednew;	/* number bytes used so far in output format buffer */
+	int usednew;	/* number bytes used so far in output format buffer */
 
 	char *ptoappend; /* pointer to string to append to output buffer */
 	int ntoappend;	/* # of bytes to append to output buffer */


More information about the Python-checkins mailing list