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

Error in stub files: Variables are not allowed in type expressions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.6, 6.7.1, 6.8.0
    • 6.7.0
    • Type hints
    • None
    • 1ae272c38 (dev), f32c87d71 (6.7), 2d18d70ea (tqtc/lts-6.5)

    Description

      The stub files use a call to type to get the NoneType.

      NoneType = type(None)  # incorrect
      

      This is not allowed in type expressions. The correct way should be as follows:

      type NoneType = type[None]  # since Python 3.12
      NoneType: TypeAlias = type[None]  # pre Python 3.12
      

      I came across this error in QtCore.pyi and QtWidgets.pyi but it probably affects other stub files too.

      sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py:285
      

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              maxxpower Markus Fleischhacker
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes