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

Result type for Slot defined as Optional[str]

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.2, 6.6.0, 6.5.3
    • 6.5.0
    • Type hints
    • None
    • 08cde5ce3 (dev), f91bcb614 (6.5)

    Description

      The typing for Slot's result, as defined in QtCore.pyi, is set to Optional[str]:

      class Slot(object):
          def __init__(self, *types: type, name: Optional[str] = ..., result: Optional[str] = ...) -> None: ...
          def __call__(self, function: Callable) -> Any: ...
      

      However that should be a type (as also specified in the actual documentation): https://doc.qt.io/qtforpython-6/PySide6/QtCore/Slot.html

      mypy also complains about setting the result as a type, even though a type is the correct value:

      ...py:100: error: Argument 1 to "addLayout" of "LayoutsMenu" has incompatible type "object"; expected "str"  [arg-type]
      

      Attachments

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

        Activity

          People

            ctismer Christian Tismer
            iborco Ionutz Borcoman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes