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

TypeError: WebEnginePage.javaScriptPrompt() takes 4 positional arguments but 5 were given

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.8.0, 6.7.1
    • 6.6.1
    • Type hints
    • None
    • Python 3.12
    • All
    • 80fac314f (dev), ab4488b00 (dev), 3eb00f380 (6.7), 1570bf0a3 (6.7), 806a32f43 (dev), 8d5b1bdf2 (dev), 4a3d0e9bf (dev), 5b8ce3933 (dev), 19f78dfd6 (6.7), 360d9b7d5 (6.7), fb40c3687 (6.7), 60bec1733 (6.7), d66b276df (dev), 3b69819ee (6.7), 5b19cf6ab (dev)

    Description

      Hi,

      When creating a subclass of QWebEnginePage:

      class WebEnginePage(QWebEnginePage):
          def javaScriptPrompt(self, url, msg, param):
              return super().javaScriptPrompt(url, msg, param)

      I got this error:

      TypeError: WebEnginePage.javaScriptPrompt() takes 4 positional arguments but 5 were given

      Which does not conform to the method specification in the pyi file:

      def javaScriptPrompt(self, securityOrigin: Union[PySide6.QtCore.QUrl, str], msg: str, defaultValue: str) -> Tuple[bool, str]: ...

      virtual protected bool 
          QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin,
                                           const QString &msg, 
                                           const QString &defaultValue, 
                                           QString *result)
      

      Attachments

        1. pyside2602_pyqt.py
          3 kB
        2. pyside2602_repro_nano.diff
          2 kB
        3. pyside2602_repro.diff
          1 kB
        4. pyside2602.html
          0.3 kB
        5. pyside2602.py
          4 kB
        For Gerrit Dashboard: PYSIDE-2602
        # Subject Branch Project Status CR V

        Activity

          People

            Unassigned Unassigned
            char101 Charles Gunawan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes