[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.48,2.49

M.-A. Lemburg python-dev@python.org
Mon, 17 Jul 2000 00:01:48 +0200


Greg Stein wrote:
> 
> Update of /cvsroot/python/python/dist/src/Objects
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv18430
> 
> Modified Files:
>         unicodeobject.c
> Log Message:
> stop messing around with goto and just write the macro correctly.
> 
> Index: unicodeobject.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
> retrieving revision 2.48
> retrieving revision 2.49
> diff -C2 -r2.48 -r2.49
> *** unicodeobject.c     2000/07/16 18:47:43     2.48
> --- unicodeobject.c     2000/07/16 21:39:49     2.49
> ***************
> *** 632,640 ****
>   }
> 
> ! #define UTF8_ERROR(details)  do {                       \
> !     if (utf8_decoding_error(&s, &p, errors, details))   \
> !         goto onError;                                   \
> !     goto nextChar;                                      \
> ! } while (0)
> 
>   PyObject *PyUnicode_DecodeUTF8(const char *s,
> --- 632,641 ----
>   }
> 
> ! #define UTF8_ERROR(details) \
> !   if (1) {                                                  \
> !       if (utf8_decoding_error(&s, &p, errors, (details)))   \
> !           goto onError;                                     \
> !       continue;                                             \
> !   } else

Greg, this doesn't work... UTF8_ERROR is used in if-clauses
and the above may alter the else-branches in subtle ways which
are just as hard to detect as the original bug. The goto may
not be the greatest in style, but it doesn't have the above
caveats.

Please revert the checkin.

> 
>   PyObject *PyUnicode_DecodeUTF8(const char *s,
> ***************
> *** 732,737 ****
>           }
>           s += n;
> - nextChar:
> -       /* empty */;
>       }
> 
> --- 733,736 ----
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://www.python.org/mailman/listinfo/python-checkins

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/