On Wed, Sep 9, 2009 at 1:53 PM, Robert
Bradshaw<[email protected]> wrote:
> On Jul 13, 2009, at 3:35 PM, Eric Eisner wrote:
>
>>>> udata = <unsigned char*><char*>pydata
>>>>
> so the double cast above seems
> like the right thing to do (the first cast extracts the string data,
> the second changes the pointer type).

However, if 'pydata' has embed null characters, the conversion will
fail. I think that the only reasonable way to handle 'bytes' ('str' in
Py2) is by using PyBytes_AsStringAndSize() (PyString_AsStringAndSize()
in Py2)... whithout the buffer size, a buffer with embed null
characters is useless.




-- 
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