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

TAB completion does not work with Python 3.10

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 6.5.0
    • 5.15.15, 6.4
    • PySide
    • None
    • Python 3.10
    • Linux/X11
    • 95e9f8fd67 (pyside/pyside-setup/dev) f554b60680 (pyside/pyside-setup/6.4) f554b60680 (pyside/tqtc-pyside-setup/6.4) 95e9f8fd67 (pyside/tqtc-pyside-setup/dev) 95e9f8fd67 (pyside/tqtc-pyside-setup/tqtc/dev) f554b60680 (pyside/pyside-setup/6.4.1)

    Description

      Readline completion in a Python interactive session works correctly with Python 3.9 and earlier, but not with Python 3.10. This means that the default TAB completion of PySide objects no longer lists any attributes.

      Thus, in Python 3.9, the expected output is shown:

      Python 3.9.15 (main, Oct 19 2022, 02:11:57) [GCC 12.2.0] on linux
      >>> from PySide6 import QtCore
      >>> import rlcompleter
      >>> c = rlcompleter.Completer() 
      >>> c.complete('QtCore.', 0) 
      'QtCore.ClassInfo('
      

      But in Python 3.10, an exception is raised:

      Python 3.10.8 (main, Oct 13 2022, 21:13:48) [GCC 12.2.0] on linux
      >>> from PySide6 import QtCore
      >>> import rlcompleter
      >>> c = rlcompleter.Completer() 
      >>> c.complete('QtCore.', 0) 
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/lib/python3.10/rlcompleter.py", line 90, in complete
          self.matches = self.attr_matches(text)
        File "/usr/lib/python3.10/rlcompleter.py", line 190, in attr_matches
          matches.append(self._callable_postfix(value, match))
        File "/usr/lib/python3.10/rlcompleter.py", line 102, in _callable_postfix
          if not inspect.signature(val).parameters:
        File "/usr/lib/python3.10/inspect.py", line 3250, in signature
          return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
        File "/usr/lib/python3.10/inspect.py", line 2998, in from_callable
          return _signature_from_callable(obj, sigcls=cls,
        File "/usr/lib/python3.10/inspect.py", line 2423, in _signature_from_callable
          raise TypeError(
      TypeError: unexpected object [<Signature (self, parent: typing.Optional[PySide2.QtCore.QObject] = None) -> None>, <Signature (self, paths: typing.Sequence[str], parent: typing.Optional[PySide2.QtCore.QObject] = None) -> None>] in __signature__ attribute
      

      Attachments

        Issue Links

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

          Activity

            People

              ctismer Christian Tismer
              kachelaqa kachelaqa kachelaqa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes