]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1556784: allow format strings longer than 127 characters in
authorGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:17:43 +0000 (11:17 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:17:43 +0000 (11:17 +0000)
datetime's strftime function.
 (backport from rev. 52072)

Lib/test/test_datetime.py
Misc/NEWS
Modules/datetimemodule.c

index 203bea150044e37ed11045f5312bd9accde16c44..436cfcad7508bc055bcf0f69168554df000bacee 100644 (file)
@@ -844,6 +844,7 @@ class TestDate(HarmlessMixedComparison):
         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
index e8a3b088e219fc0d1c3d48656a9c11f5edcfb40b..55ef60ff973822441e435f1778deace2b65e3bd7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -35,6 +35,9 @@ Core and builtins
 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.
 
 
index 648ebe5af346dcb3be99d4a8d5d70d23cdaa56ec..39a859f3e5d4a6b071ec97fccbf2f0deb793886a 100644 (file)
@@ -1149,9 +1149,9 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
 
        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 */