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

Fail to subclass QWidget using type() if snake_case or true_property is on

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 6.0.0
    • PySide
    • None
    • Windows 10 20H2, Python 3.6.12, 3.9.1
    • Windows
    • b6d1b76b46d7b756f7cb01361037e1cb5efc990a (pyside/pyside-setup/dev) b9a89e1f3c8d0b80cc91bf1d277ead3b7857dabd (pyside/pyside-setup/6.0)

    Description

      Python crashes on line QWrapper = type(...) if snake_case or true_property is activated. There's no such an issue with PySide2/Python 3.9.1

      try:
          from PySide6 import QtWidgets
      except ImportError:
          from PySide2 import QtWidgets
      from __feature__ import snake_case, true_property
      
      if __name__ == '__main__':
          app = QtWidgets.QApplication([])
      
          W = QtWidgets.QWidget
          W.font_info  # check snake case
          print("QWidget", W, W())
      
          class QWrapper(QtWidgets.QWidget):
              pass
          print("Subclass", QWrapper, QWrapper())
      
          class QWrapper:
              pass
          QWrapper = type("QWrapper", (QWrapper, QtWidgets.QWidget,), {})
          print("type() subclass", QWrapper, QWrapper())
      

      Attachments

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

        Activity

          People

            ctismer Christian Tismer
            winand Andrey Makarov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes