Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2792

(Shiboken6) wrong type returned for signal containing a custom object called 'Connection'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.0
    • 6.7.2
    • PySide, Shiboken
    • None
    • Windows
    • 5bf6334c1 (dev), 816474711 (dev), 16098891a (dev), fd251ca8e (dev), 7729ee345 (6.7)

    Description

      Some background; I'm working with a proprietary communication library which is written in QT/C++. Currently I'm in the process of generating PySide6 bindings for this codebase using Shiboken6.

      On of the existing classes exposes a signal whenever a connection changes, which contains a Connection object, containing some metadata.

      signals:    void update(Connection connection); 

      So far so good, but when importing and using the library in my Python client, the wrong type is returned to the signal handler, suddenly this is a 'PySide6.QtCore.QMetaObject.Connection'.

      If i use a different class name for the signal value, everything works as expected. To prove this behaviour, i've put together a small proof of concept, which outputs the following:

      Test OK got: <ProofOfConcept.FooBar object at 0x0000019A42EFB180> .. <class 'ProofOfConcept.FooBar'> 
      Test bug got: <PySide6.QtCore.QMetaObject.Connection object at 0x0000019A42EFB180> Traceback (most recent call last):   File "c:\Users\nicoll\Downloads\bug_wrong_type_returned\installation_area\ProofOfConcept\test.py", line 12, in handle_test_bug     assert(isinstance(value, Connection)) # Fails, we got PySide6.QtCore.QMetaObject.Connection     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError Done

      As far as I can tell, all types get generated successfully and this is not the behaviour I would expect.

      I've attached both a build proof of concept (MSVC) and the source.

      Attachments

        For Gerrit Dashboard: PYSIDE-2792
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            lexn Lex Nicolaes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: