Ray.Allen <ysj....@gmail.com> added the comment:

Hi, haypo, Your patch seems cannot be applied cleanly on current py3k trunk. 
And after modified your patch, test_unicode.py runs into Segmentation fault. Is 
there something wrong or some changes which could influence this bug had been 
already made since the patch is worked out?


On the current trunk, I guess the bug could be fixed in a simpler way:

In step 1, before check '%%', check '%'(a string ends with '%') first. Then 
check '%%' and skip it.

The whole patch:

Index: Objects/unicodeobject.c
===================================================================
--- Objects/unicodeobject.c     (revision 88453)
+++ Objects/unicodeobject.c     (working copy)
@@ -750,8 +750,12 @@
      * result in an array) */
     for (f = format; *f; f++) {
          if (*f == '%') {
-             if (*(f+1)=='%')
+             if (*(f+1)=='\0')
+                continue;
+             if (*(f+1)=='%') {
+                 f++;
                  continue;
+             }
              if (*(f+1)=='S' || *(f+1)=='R' || *(f+1)=='A')
                  ++callcount;
              while (Py_ISDIGIT((unsigned)*f))


After applying this small patch and tests in your patch, test_unicode.py can 
passed.

----------
nosy: +ysj.ray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to