[Python-3000-checkins] r55428 - python/branches/py3k-struni/Objects/unicodeobject.c

Guido van Rossum guido at python.org
Fri May 18 16:37:57 CEST 2007


I hope this doesn't mean you assume there's room for a null byte in
all unicode objects -- there are several other places that allocate or
reallocate. There's even another call to _PyUnicode_New() earlier in
the same function.

On 5/18/07, walter.doerwald <python-3000-checkins at python.org> wrote:
> Author: walter.doerwald
> Date: Fri May 18 13:30:40 2007
> New Revision: 55428
>
> Modified:
>    python/branches/py3k-struni/Objects/unicodeobject.c
> Log:
> Allocate one more character, so that the terminating
> nullbyte can be copied.
>
>
> Modified: python/branches/py3k-struni/Objects/unicodeobject.c
> ==============================================================================
> --- python/branches/py3k-struni/Objects/unicodeobject.c (original)
> +++ python/branches/py3k-struni/Objects/unicodeobject.c Fri May 18 13:30:40 2007
> @@ -427,7 +427,7 @@
>         }
>      }
>
> -    unicode = _PyUnicode_New(size);
> +    unicode = _PyUnicode_New(size+1);
>      if (!unicode)
>          return NULL;
>
> _______________________________________________
> Python-3000-checkins mailing list
> Python-3000-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-3000-checkins
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000-checkins mailing list