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

sys.excepthook is called with delay

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.1, 6.8.0.1
    • 6.8.0, 6.8.0.1
    • PySide
    • None
    • Linux/Wayland, Windows
    • e7c2b6ea1 (dev), ca28f2c82 (6.8), 588b84490 (6.8.0), bb213a175 (tqtc/6.8.0)

    Description

      Up to 6.7.3, exceptions called sys.excepthook immediately. From 6.8.0, sys.excepthook is called with (sometimes very long) delay.

      The following code illustrates that. In 6.7.3, the window opens and a message box is shown immedietaly. In 6.8.0(.1), the window opens and hangs. Only when you close the window do you see the message box.

      import sys
      
      from PySide6.QtCore import QTimer, Slot
      from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox
      
      class Window(QMainWindow):
          def __init__(self):
              super().__init__()
              self.show()
              sys.excepthook = self.excepthook
              QTimer().singleShot(500, self.raise_)
      
          def excepthook(self, *_):
              QMessageBox.critical(self, "Error", "Error")
              sys.exit()
      
          @Slot()
          @staticmethod
          def raise_():
              print("RuntimeError")
              raise RuntimeError
      
      app = QApplication()
      window = Window()
      sys.exit(QApplication.exec())
      

       

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            bers bers bers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes