Re: [Cython] Potential bug: hole in "C <-> Python" conversion
Dieter Maurer, 29.06.2012 12:18:
> Stefan Behnel wrote at 2012-6-29 11:42 +0200:
>> Also note that libc.string contains declarations for "const char*" and friends.
Nice word, took me a while to make my brain split the characters correctly. ;)
> I need "const unsigned char*" and "const xmlChar *"
> (where "xmlChar" is defined as "unsigned char").
Ah, right, libxml2 - an excellent example. lxml is still suffering from the
decision of its initial author to ignore C compiler warnings ("for now")
and use plain char* instead. Lesson learned: DON'T DO THAT!
I recently started cleaning that up (which is why Cython now understands
and coerces "unsigned char*" as well), but you wouldn't believe how much
work it is to get "const" right after the fact if you have a sufficiently
large code base. The current (udiff) patch in my patch queue is some 3000
lines and still growing, but at least the compiler warnings look like
they'd soon fit on a single page. That's about the point where I need to
start tackling the really tough problems.
> I used the "libc.string" definitions as a blueprint for mine.
Sure, as long as the types are correct. lxml will have them declared in
tree.pxd at some point.
BTW, you might want to upgrade to a more recent Cython in any case. 0.13 is
almost two years old and lacks a lot of nice language features. lxml 2.4