Comment 12 for bug 312462

Revision history for this message
Pete (pt.pete.pt) wrote :

Ok,

as this bug is open for 4 years now, I spent the afternoon fixing it. The solution was quite easy.

The auto generated wrapping from the .defs file is not sufficient. I added a method to the .override file, which solves the problem.

The problem was, that the C function requires a char pointer (which is not \x00 terminated) and the length. But the automatic mapping interpreted it as a null terminated string and therefore threw a TypeError (because pdf documents typically contain null bytes).

I fixed the mapping by changing "si" to "s#" (http://docs.python.org/c-api/arg.html), which allows null bytes and also renders the length parameter redundant. Therefore I removed it as Benjamin suggested.

As this method probably never worked, there should be no fear to remove the length parameter when thinking about backward compatibility.

Have a nice evening.