[Python-checkins] r83446 - in python/branches/release27-maint: Objects/unicodeobject.c

M.-A. Lemburg mal at egenix.com
Mon Aug 2 10:42:41 CEST 2010


Hi Georg,

georg.brandl wrote:
> Author: georg.brandl
> Date: Sun Aug  1 22:54:30 2010
> New Revision: 83446
> 
> Log:
> Recorded merge of revisions 83444 via svnmerge from 
> svn+ssh://pythondev@svn.python.org/python/branches/py3k
> 
> ........
>   r83444 | georg.brandl | 2010-08-01 22:51:02 +0200 (So, 01 Aug 2010) | 1 line
>   
>   Revert r83395, it introduces test failures and is not necessary anyway since we now have to nul-terminate the string anyway.
> ........
> 
> 
> Modified:
>    python/branches/release27-maint/   (props changed)
>    python/branches/release27-maint/Objects/unicodeobject.c
> 
> Modified: python/branches/release27-maint/Objects/unicodeobject.c
> ==============================================================================
> --- python/branches/release27-maint/Objects/unicodeobject.c	(original)
> +++ python/branches/release27-maint/Objects/unicodeobject.c	Sun Aug  1 22:54:30 2010
> @@ -294,7 +294,7 @@
>  }
>  
>  /* We allocate one more byte to make sure the string is
> -   Ux0000 terminated -- XXX is this needed ?
> +   Ux0000 terminated; some code relies on that.

While that's unfortunately true (e.g. some Windows APIs need this),
the code in unicodeobject.c should not rely on this !

Also note that the codec functions work on Py_UNICODE buffers which
are *not* guaranteed to be NUL-terminated.

>     XXX This allocator could further be enhanced by assuring that the
>     free list never reduces its size below 1.
> @@ -3067,7 +3067,7 @@
>  
>              ch2 = *s++;
>              size--;
> -            if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
> +            if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
>                  ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
>                  *p++ = '\\';
>                  *p++ = 'U';
> @@ -3316,7 +3316,7 @@
>  
>                  ch2 = *s++;
>                  size--;
> -                if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
> +                if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
>                      ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
>                      *p++ = '\\';
>                      *p++ = 'U';
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 02 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-checkins mailing list