diff options
| author | Christian Tismer <tismer@stackless.com> | 2022-11-11 10:11:03 +0100 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2022-12-22 17:43:32 +0100 |
| commit | b71aa9a77a09f60d1a64a0544bdfc9323debe0e9 (patch) | |
| tree | 5cb30c50e455c07846e5e6e475ce70a34fe64aff /sources/pyside6/PySide6/support | |
| parent | d0eb2ab803834defd23d97f7ee9bef1f09307e8b (diff) | |
signature: Evict the __signature__ attribute, long live signature!
The __signature__ attribute was used since 2017 with success.
With Python 3.10, there was an incompatibility introduced by
the rlcompleter module. This was detected quite late, because
there is no exception thrown in normal line completion.
Using the rlcompleter module directly, the error can be seen.
The problem is not the attribute itself, but PySide's need to
support *multi-signature*. The signature objects are either
regular compatible Signature objects, or in the multi-case,
*lists* thereof.
Since PyPy was implemented, the internal use of the __signature__
attribute was replaced by a get_signature() call. The attribute
was never documented in the public until recently in the
developer docs. We therefor can assume that removal of the
attribute will cause no problems.
[ChangeLog][PySide6] The non-standard __signature__ attribute of
functions and classes was removed in favor of get_signature().
No Pick-to because this is meant for 6.5
Change-Id: Iaa8bb08a33db66868d949593e527b753bf989681
Fixes: PYSIDE-2101
Task-number: PYSIDE-510
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/support')
| -rw-r--r-- | sources/pyside6/PySide6/support/deprecated.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/sources/pyside6/PySide6/support/deprecated.py b/sources/pyside6/PySide6/support/deprecated.py index 449a5d2f0..f215f2ff5 100644 --- a/sources/pyside6/PySide6/support/deprecated.py +++ b/sources/pyside6/PySide6/support/deprecated.py @@ -18,8 +18,6 @@ PYSIDE-1735: This is also used now for missing other functions (overwriting __or in Qt.(Keyboard)Modifier). """ -import inspect -import sys import warnings from textwrap import dedent @@ -70,28 +68,4 @@ def fix_for_QtCore(QtCore): Qt.Modifier.__add__ = func_add Qt.Modifier.__radd__ = func_add - # PYSIDE-2101: Fix rlcompleter until we evict the __signature__ attribute - apply_rlcompleter_patch() - - -def apply_rlcompleter_patch(): - - def _callable_postfix(self, val, word): - if callable(val): - word += "(" - try: - if not inspect.signature(val).parameters: - word += ")" - except ValueError: - pass - # PYSIDE-2101: this line is added because inspect.signature cannot handle lists - except TypeError: - pass - - return word - - if sys.version_info[:2] >= (3, 10): - from rlcompleter import Completer - Completer._callable_postfix = _callable_postfix - # eof |
