On Jul 13, 2009, at 6:47 AM, Eric Eisner wrote:

> Hi,
>
> I was working on a wrapper for a c function that took an unsigned
> char* and its length (the string could have null bytes, so it needs a
> specific length). I was having some trouble getting cython to compile
> a simple conversion of string to unsigned char*, the way I eventually
> got it to work is:
>
> udata = <unsigned char*><char*>pydata
>
> This was a surprising requirement that took me a while to figure out.
> Is it intentional that strings cannot be directly cast to unsigned
> char?

No, I don't think that's intentional.

> If not, I assume this can be fixed easily...by someone who
> understands the code of course.

Yes, I think that could be fixed relatively easy. However, note that  
casting Python objects directly to char* is skirting all unicode/ 
charset issues.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to