[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.45,2.46
M.-A. Lemburg
python-dev@python.org
2000年7月16日 06:29:19 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv1189/Objects
Modified Files:
unicodeobject.c
Log Message:
Fix to a bug found by Florian Weimer:
The UTF-8 decoder is still buggy (i.e. it doesn't pass Markus Kuhn's
stress test), mainly due to the following construct:
#define UTF8_ERROR(details) do { \
if (utf8_decoding_error(&s, &p, errors, details)) \
goto onError; \
continue; \
} while (0)
(The "continue" statement is supposed to exit from the outer loop,
but of course, it doesn't. Indeed, this is a marvelous example of
the dangers of the C programming language and especially of the C
preprocessor.)
Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.45
retrieving revision 2.46
diff -C2 -r2.45 -r2.46
*** unicodeobject.c 2000年07月16日 12:04:31 2.45
--- unicodeobject.c 2000年07月16日 13:29:13 2.46
***************
*** 635,639 ****
if (utf8_decoding_error(&s, &p, errors, details)) \
goto onError; \
! continue; \
} while (0)
--- 635,639 ----
if (utf8_decoding_error(&s, &p, errors, details)) \
goto onError; \
! goto nextChar; \
} while (0)
***************
*** 732,735 ****
--- 732,736 ----
}
s += n;
+ nextChar:
}