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.

** Patch added: "Fixes the wrapped interface."
   
https://bugs.launchpad.net/poppler-python/+bug/312462/+attachment/3226154/+files/poppler.override.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/312462

Title:
  document_new_from_data() arg1 must be without null bytes

To manage notifications about this bug go to:
https://bugs.launchpad.net/poppler-python/+bug/312462/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to