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

Using __slots__ in PySide subclasses segfaults

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.4, 6.3.0
    • Fix Version/s: None
    • Component/s: PySide, Shiboken
    • Labels:
      None
    • Environment:
      Python 3.10
      PySide6 6.3.0
      shiboken6 6.3.0
      Linux

      Description

      Defining __slots__ in a PySide subclass segfaults on attribute assignment

      from PySide6.QtCore import QObject
      
      
      class Obj(QObject):
          __slots__ = ("a",)
      
          def __init__(self, *args, **kwargs):
              super().__init__(*args, **kwargs)
              self.a = 1  # <<< segfaults here
      
      
      obj = Obj()
      

      Note: the __slots__ is python feature unrelated to Qt's signal/slot mechanism.

      https://docs.python.org/3/reference/datamodel.html?highlight=__slots__#object.__slots__

        Attachments

        1. pyside1970_stack1.txt
          0.8 kB
        2. pyside1970_stack2.txt
          3 kB
        3. pyside1970.py
          0.6 kB
        For Gerrit Dashboard: PYSIDE-1970
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            shpremna Shyamnath Premnadh
            Reporter:
            aleserjavec Ales Erjavec
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes