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

Segfault after reassignment of class attributes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 5.11.1
    • 1.2.2
    • PySide, Shiboken
    • Debian testing, amd64, python3

    Description

      After reassigning a local attribute, that attribute seems to be deleted, which may lead to segfaults. Please see the following minimal example:

      #!/usr/bin/env python3
      
      from PySide.QtCore import QObject
      
      def modify(klass):
          klass.my_list = [3.14] + klass.my_list
          return klass
      
      #@modify
      class A(QObject):
          my_list = ["a"]
      
      print(A().my_list)
      
      AA = modify(A)
      
      print(A().my_list)
      print(AA().my_list)
      

      For me, the output is:

      $ ./pyside_test.py 
      ['a']
      [<NULL>]
      Segmentation fault
      

      At least the [<NULL>] result also appears for this modification of A:

      A.my_list = [3.14] + A.my_list
      

      Attachments

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            dh_ds Daniel Hornung
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: