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

Stub files have numerous conflicting overloads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated Not Evaluated
    • 6.8.1
    • 6.7.0
    • Type hints
    • None
    • 8a416e88c (dev), c0edf645f (6.8)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes