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

Stub files have numerous conflicting overloads

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.7.0
    • Type hints
    • None

    Description

      There are multiple issues with overlapping or incompatible overload signatures in the stub files.

      There are broadly 3 categories of this issue.

      1. Conflicting overloads

      Different return types with overlapping argument types. For example:

      class QWidget(PySide6.QtCore.QObject, PySide6.QtGui.QPaintDevice):
          @overload
          def mapTo(self, arg__1: PySide6.QtWidgets.QWidget, arg__2: PySide6.QtCore.QPoint) -> PySide6.QtCore.QPoint: ...
          @overload
          def mapTo(self, arg__1: PySide6.QtWidgets.QWidget, arg__2: Union[PySide6.QtCore.QPointF, PySide6.QtCore.QPoint, PySide6.QtGui.QPainterPath.Element]) -> PySide6.QtCore.QPointF: ...

      2. Compatible overlapping overloads

      One of the overloads is unneccessary because it is already covered by the other.

      class QCborStreamReader(Shiboken.Object):
          @overload
          def addData(self, data: Union[bytes, bytearray, memoryview], len: int) -> None: ...
          @overload
          def addData(self, data: bytearray, len: int) -> None: ...

      3. Duplicate identical overloads

      class QByteArray(Shiboken.Object):
          @overload
          @staticmethod
          def number(arg__1: int, base: int = ...) -> PySide6.QtCore.QByteArray: ...
          @overload
          @staticmethod
          def number(arg__1: int, base: int = ...) -> PySide6.QtCore.QByteArray: ...

      I came across those issues in QtCore.pyi and QtWidgets.pyi but I'm sure other stubs are affected too.
      Depending on the strictness of the type checker, there are also other overload and override issues.

      Attachments

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

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            maxxpower Markus Fleischhacker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes