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

Shared pointer must be convertible to base class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.15.1
    • Fix Version/s: 5.15.2
    • Component/s: Shiboken
    • Labels:
      None
    • Platform/s:
      All

      Description

      In an example where we have two classes:

      class A {};
      
      class B:A {}; // has 'A' as base class
      

      Today is not possible to pass SharedPointer<B>  to a function that accepts SharedPointer<A>;

      Since SharedPointer<B> is not derived from SharedPointer<A> shiboken fails to covert it back to CPP;

      Problem #1 is signature

      RUN 1: ERROR: testSmartPointerConversions (__main__.SmartPointerTests)
      RUN 1: ----------------------------------------------------------------------
      RUN 1: Traceback (most recent call last):
      RUN 1:   File "sources/shiboken2/tests/smartbinding/smart_pointer_test.py", line 226, in testSmartPointerConversions
      RUN 1:     r = o.takeSharedPtrToInteger(integer2)
      RUN 1: TypeError: 'smart.Obj.takeSharedPtrToInteger' called with wrong argument types:
      RUN 1:   smart.Obj.takeSharedPtrToInteger(SharedPtr_Smart_Integer2)
      RUN 1: Supported signatures:
      RUN 1:   smart.Obj.takeSharedPtrToInteger(smart.SharedPtr[smart.Integer])
       

      Not sure if the C++ binding would work.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            renatofilho renato araujo oliveira filho
            Reporter:
            renatofilho renato araujo oliveira filho
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes