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

M.-A. Lemburg mal@lemburg.com
Wed, 18 Apr 2001 23:57:15 +0200


"Martin v. L?wis" wrote:
> 
> Update of /cvsroot/python/python/dist/src/Objects
> In directory usw-pr-cvs1:/tmp/cvs-serv32029
> 
> Modified Files:
>         unicodeobject.c
> Log Message:
> Patch #416953: Cache ASCII characters to speed up ASCII decoding.

Hmm, why didn't you post the modified patch to SF first ?
There are some things which need tweaking before going prime time...

BTW, please use 4 space indents for the unicodeobject.c file.
 
> Index: unicodeobject.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
> retrieving revision 2.82
> retrieving revision 2.83
> diff -C2 -r2.82 -r2.83
> *** unicodeobject.c     2001/04/12 18:38:48     2.82
> --- unicodeobject.c     2001/04/18 12:49:15     2.83
> ***************
> *** 91,94 ****
> --- 91,96 ----
>   static int unicode_freelist_size;
> 
> + static PyUnicodeObject *unicode_ascii[128];
> +
>   /* Default encoding to use and assume when NULL is passed as encoding
>      parameter; it is initialized by _PyUnicode_Init().
> ***************
> *** 252,255 ****
> --- 254,270 ----
>       PyUnicodeObject *unicode;

Note that u can be NULL here !

> +     if (size == 1 && *u < 128) {
> ...

Please also check why test_unicodedata fails with the patch 
applied.

Thanks,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Pages:                           http://www.lemburg.com/python/