Private sip modules conflict with public sip module

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Private sip modules conflict with public sip module

Scott Talbert
Hi,

See the below example:

$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.sip
>>> import sip
>>> sip
<module 'PyQt5.sip' from
'/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>

Basically, if you import a private sip module and then import the public
one, it doesn't work.  It seems to be due to this:

https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293

Scott
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Phil Thompson-5
On 18/08/2019 04:14, Scott Talbert wrote:

> Hi,
>
> See the below example:
>
> $ python3
> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import PyQt5.sip
>>>> import sip
>>>> sip
> <module 'PyQt5.sip' from
> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>
>
> Basically, if you import a private sip module and then import the
> public one, it doesn't work.  It seems to be due to this:
>
> https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293

Why would you want to do that?

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Scott Talbert
On Sun, 18 Aug 2019, Phil Thompson wrote:

>> See the below example:
>>
>> $ python3
>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import PyQt5.sip
>>>>> import sip
>>>>> sip
>> <module 'PyQt5.sip' from
>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>
>>
>> Basically, if you import a private sip module and then import the
>> public one, it doesn't work.  It seems to be due to this:
>>
>> https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>
> Why would you want to do that?

I don't particularly *want* to do that, but it happens in the wild with
applications.  For example:

fsleyes imports matplotlib
matplotlib imports PyQt as part of its backend detection
fsleyes imports wxpython
wxpython imports sip -> fail

Scott
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Phil Thompson-5
On 18/08/2019 15:45, Scott Talbert wrote:

> On Sun, 18 Aug 2019, Phil Thompson wrote:
>
>>> See the below example:
>>>
>>> $ python3
>>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>>> Type "help", "copyright", "credits" or "license" for more
>>> information.
>>>>>> import PyQt5.sip
>>>>>> import sip
>>>>>> sip
>>> <module 'PyQt5.sip' from
>>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>>
>>>
>>> Basically, if you import a private sip module and then import the
>>> public one, it doesn't work.  It seems to be due to this:
>>>
>>> https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>>
>> Why would you want to do that?
>
> I don't particularly *want* to do that, but it happens in the wild
> with applications.  For example:
>
> fsleyes imports matplotlib
> matplotlib imports PyQt as part of its backend detection
> fsleyes imports wxpython
> wxpython imports sip -> fail

wxpython uses a private copy of the sip module so I don't see what is
importing a top-level sip module in that situation.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Scott Talbert


On August 18, 2019 11:03:21 AM EDT, Phil Thompson <[hidden email]> wrote:

>On 18/08/2019 15:45, Scott Talbert wrote:
>> On Sun, 18 Aug 2019, Phil Thompson wrote:
>>
>>>> See the below example:
>>>>
>>>> $ python3
>>>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>>>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>>>> Type "help", "copyright", "credits" or "license" for more
>>>> information.
>>>>>>> import PyQt5.sip
>>>>>>> import sip
>>>>>>> sip
>>>> <module 'PyQt5.sip' from
>>>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>>>
>>>>
>>>> Basically, if you import a private sip module and then import the
>>>> public one, it doesn't work.  It seems to be due to this:
>>>>
>>>>
>https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>>>
>>> Why would you want to do that?
>>
>> I don't particularly *want* to do that, but it happens in the wild
>> with applications.  For example:
>>
>> fsleyes imports matplotlib
>> matplotlib imports PyQt as part of its backend detection
>> fsleyes imports wxpython
>> wxpython imports sip -> fail
>
>wxpython uses a private copy of the sip module so I don't see what is
>importing a top-level sip module in that situation.

I guess I left out an important detail.  I patch wxPython to use the top-level sip module.

Scott
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Scott Talbert


On August 18, 2019 11:39:22 AM EDT, Scott Talbert <[hidden email]> wrote:

>
>
>On August 18, 2019 11:03:21 AM EDT, Phil Thompson
><[hidden email]> wrote:
>>On 18/08/2019 15:45, Scott Talbert wrote:
>>> On Sun, 18 Aug 2019, Phil Thompson wrote:
>>>
>>>>> See the below example:
>>>>>
>>>>> $ python3
>>>>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>>>>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>>>>> Type "help", "copyright", "credits" or "license" for more
>>>>> information.
>>>>>>>> import PyQt5.sip
>>>>>>>> import sip
>>>>>>>> sip
>>>>> <module 'PyQt5.sip' from
>>>>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>>>>
>>>>>
>>>>> Basically, if you import a private sip module and then import the
>>>>> public one, it doesn't work.  It seems to be due to this:
>>>>>
>>>>>
>>https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>>>>
>>>> Why would you want to do that?
>>>
>>> I don't particularly *want* to do that, but it happens in the wild
>>> with applications.  For example:
>>>
>>> fsleyes imports matplotlib
>>> matplotlib imports PyQt as part of its backend detection
>>> fsleyes imports wxpython
>>> wxpython imports sip -> fail
>>
>>wxpython uses a private copy of the sip module so I don't see what is
>>importing a top-level sip module in that situation.
>
>I guess I left out an important detail.  I patch wxPython to use the
>top-level sip module.

But this is just one example.  I guess the bottom line is: do you consider this a bug, or is your answer that no one should using the top-level sip module?

Scott
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Phil Thompson-5
On 18/08/2019 16:52, Scott Talbert wrote:

> On August 18, 2019 11:39:22 AM EDT, Scott Talbert <[hidden email]>
> wrote:
>>
>>
>> On August 18, 2019 11:03:21 AM EDT, Phil Thompson
>> <[hidden email]> wrote:
>>> On 18/08/2019 15:45, Scott Talbert wrote:
>>>> On Sun, 18 Aug 2019, Phil Thompson wrote:
>>>>
>>>>>> See the below example:
>>>>>>
>>>>>> $ python3
>>>>>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>>>>>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>>>>>> Type "help", "copyright", "credits" or "license" for more
>>>>>> information.
>>>>>>>>> import PyQt5.sip
>>>>>>>>> import sip
>>>>>>>>> sip
>>>>>> <module 'PyQt5.sip' from
>>>>>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>>>>>
>>>>>>
>>>>>> Basically, if you import a private sip module and then import the
>>>>>> public one, it doesn't work.  It seems to be due to this:
>>>>>>
>>>>>>
>>> https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>>>>>
>>>>> Why would you want to do that?
>>>>
>>>> I don't particularly *want* to do that, but it happens in the wild
>>>> with applications.  For example:
>>>>
>>>> fsleyes imports matplotlib
>>>> matplotlib imports PyQt as part of its backend detection
>>>> fsleyes imports wxpython
>>>> wxpython imports sip -> fail
>>>
>>> wxpython uses a private copy of the sip module so I don't see what is
>>> importing a top-level sip module in that situation.
>>
>> I guess I left out an important detail.  I patch wxPython to use the
>> top-level sip module.
>
> But this is just one example.  I guess the bottom line is: do you
> consider this a bug, or is your answer that no one should using the
> top-level sip module?

No up to date package should be using a top-level sip module.

If you are patching wxpython(!) then you can remove the reference PyQt
adds sys.modules first.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Private sip modules conflict with public sip module

Scott Talbert


On August 18, 2019 12:31:59 PM EDT, Phil Thompson <[hidden email]> wrote:

>On 18/08/2019 16:52, Scott Talbert wrote:
>> On August 18, 2019 11:39:22 AM EDT, Scott Talbert <[hidden email]>
>> wrote:
>>>
>>>
>>> On August 18, 2019 11:03:21 AM EDT, Phil Thompson
>>> <[hidden email]> wrote:
>>>> On 18/08/2019 15:45, Scott Talbert wrote:
>>>>> On Sun, 18 Aug 2019, Phil Thompson wrote:
>>>>>
>>>>>>> See the below example:
>>>>>>>
>>>>>>> $ python3
>>>>>>> Python 3.7.4 (default, Jul  9 2019, 16:32:37)
>>>>>>> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
>>>>>>> Type "help", "copyright", "credits" or "license" for more
>>>>>>> information.
>>>>>>>>>> import PyQt5.sip
>>>>>>>>>> import sip
>>>>>>>>>> sip
>>>>>>> <module 'PyQt5.sip' from
>>>>>>> '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>>>>>>>>>
>>>>>>>
>>>>>>> Basically, if you import a private sip module and then import
>the
>>>>>>> public one, it doesn't work.  It seems to be due to this:
>>>>>>>
>>>>>>>
>>>>
>https://www.riverbankcomputing.com/hg/sip/file/4.19-maint/siplib/siplib.c#l1293
>>>>>>
>>>>>> Why would you want to do that?
>>>>>
>>>>> I don't particularly *want* to do that, but it happens in the wild
>>>>> with applications.  For example:
>>>>>
>>>>> fsleyes imports matplotlib
>>>>> matplotlib imports PyQt as part of its backend detection
>>>>> fsleyes imports wxpython
>>>>> wxpython imports sip -> fail
>>>>
>>>> wxpython uses a private copy of the sip module so I don't see what
>is
>>>> importing a top-level sip module in that situation.
>>>
>>> I guess I left out an important detail.  I patch wxPython to use the
>>> top-level sip module.
>>
>> But this is just one example.  I guess the bottom line is: do you
>> consider this a bug, or is your answer that no one should using the
>> top-level sip module?
>
>No up to date package should be using a top-level sip module.
>
>If you are patching wxpython(!) then you can remove the reference PyQt
>adds sys.modules first.

That seems way too fragile.  I would have to do that anywhere wx imports sip, and any wx users that use sip would have to do it too.

I can probably live with switching back to the namespaced sip module though.

Scott
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt