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

Subclassing QObject with a dataclass results in AttributeError

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.14.0
    • Fix Version/s: 5.15.1
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      macOS Mojave - Python 3.7.5
    • Platform/s:
      All
    • Commits:
      9a37b64bbee7573578f63334b76a3eca533ea539 (pyside/pyside-setup/5.15)

      Description

      Having the following code

      from PySide2.QtCore import QObject
      from dataclasses import dataclass
      
      @dataclass
      class SomeObject(QObject):
          pass
      

      Generates the following error:

        File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py", line 991, in dataclass
          return wrap(_cls)
        File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py", line 983, in wrap
          return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
        File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py", line 960, in _process_class
          str(inspect.signature(cls)).replace(' -> None', ''))
      AttributeError: attribute '__doc__' of 'Shiboken.ObjectType' objects is not writable
      

      I can say this is not an issue with PySide2 5.12.5, I have not checked any of the 5.13 versions.

        Attachments

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

          Activity

            People

            Assignee:
            ctismer Christian Tismer
            Reporter:
            j9ac9k Ognyan Moore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes