[PyQt] How to test for isinstance(obj, sip.wrappertype)?

Steve Borho steve at borho.org
Sun Apr 19 20:52:22 BST 2020


How does one test that a Python object is a SIP wrapped object?

Python 3.7.7 (default, Mar 10 2020, 15:43:33) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from foo import barstruct
>>> type(barstruct)
<class 'sip.wrappertype'>
>>> import sip
>>> t = barstruct()
>>> isinstance(t, sip.wrappertype)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sip' has no attribute ‘wrappertype'


Steve Borho

More information about the PyQt mailing list