On Fri, Nov 27, 2009 at 8:55 PM, Greg Ewing <[email protected]> wrote:
> Lisandro Dalcin wrote:
>
>> Sorry, Greg, I got lost. It seems I still have things to learn in Py3.
>> How do you avoid the memory allocation in the case of UTF-8 ?
>
> I haven't looked in detail, but I believe that the str object
> is able to hold a cached encoding of itself in utf8, so the
> conversion could just return a pointer to that.
>

Yes, that's the way things worked in Py2 (with def.encodding ascii).
In Py3, that stuff is still there, but these API's are commented
deprecated in Include/unicodeobject.h. These comments also recommend
to use PyUnicode_AsUTF8String().
http://svn.python.org/view/python/branches/py3k/Include/unicodeobject.h?view=markup

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to