[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: PyKDL fails to import after PyQt5.QtCore
From:       Dmitry Shachnev <mitya57 () ubuntu ! com>
Date:       2021-03-16 12:23:43
Message-ID: YFCjT3RqA783YBWV () mitya57 ! me
[Download RAW message or body]


Hi Timon!

On Mon, Mar 15, 2021 at 02:23:59PM +0100, Timon Engelke wrote:
> Hey,
>
> I am on Debian Testing and noticed the following error when using PyQt5 and
> PyKDL:
>
> >>> import PyQt5.QtCore
> >>> import PyKDL
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ValueError: PyCapsule_GetPointer called with incorrect name
>
> When I import PyKDL before PyQt5.QtCore, both imports are successful.

Debian maintainer of PyQt5 here, I want to add some debugging information.

PyKDL is an old-style SIP v4 package. The generated PyInit_PyKDL code
contains this line:

    sipAPI_PyKDL = reinterpret_cast<const sipAPIDef *>(PyCapsule_GetPointer(sip_capiobj, "sip._C_API"));

Then, PyCapsule_GetPointer produces the "called with incorrect name" error
when name does not match capsule->name. Here, name is "sip._C_API" and
capsule->name is "PyQt5.sip._C_API".

It looks like this error happens because PyQt5.sip module registers itself
also as "sip" for backwards compatibility:

https://riverbankcomputing.com/hg/sip/file/5.5.0/sipbuild/module/source/12.8/siplib.c#l1237

Maybe Phil can add more details here, but I think the only way to resolve
this will be importing PyKDL before PyQt5.QtCore, until PyKDL gets ported to
a newer SIP version.

--
Dmitry Shachnev

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic