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

Segfault when adding None to Layout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.0, 6.6.3, 6.5.6
    • 6.6.2
    • PySide
    • None
    • macOS
    • c5a601ca9 (dev), d93415ed8 (6.6), fb473a78c (tqtc/lts-6.5)

    Description

      I found the following issue when passing the return value of a method that should return a widget returned None instead to QLayout.addWidget().

      For the following code example, all calls to addWidget result in a TypeError, except the one with None. This one causes a segmentation fault. My expectation would be that it raises a TypeError as well.

      from PySide6.QtWidgets import QApplication, QHBoxLayout
      
      app = QApplication()
      layout = QHBoxLayout()
      
      try:
          layout.addWidget(1)
      except TypeError:
          pass
      
      try:
          layout.addWidget("foo")
      except TypeError:
          pass
      
      try:
          layout.addWidget(None)
      except TypeError:
          pass
      
      app.quit()

      Attachments

        1. pyside2638_stack.txt
          12 kB
        2. pyside2638.py
          0.8 kB

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              tilmankrummeck Tilman Krummeck
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes