aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-04-20 17:46:31 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-20 18:48:14 +0000
commit7846820197b95ffc74e899df600542f5f2eaf3c7 (patch)
tree9cf09e37ef24b15be01bb1530b45f534a9713a8b
parent1513d87904ad53d80d0b95866ce5692d2c96a8bd (diff)
signature: Refine the decision heuristics of result tuples
Result tuples do not (yet) get information from XML. Instead, they fetch their info solely from the embedded signature strings and information encoded in mapping.py . When a variable is determined as a result variable, it is removed from the arg list and normally appended to the return tuple. It turned out that a special rule is needed: A variable that comes first in the variable list should also be first in the result tuple. This heuristics should be replaced by more introspection. Right now, this suffices as a working fix. Fixes: PYSIDE-1409 Change-Id: Ib65682439e2f678380e0f58a42a36506d0766ddf Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 3506158551488788450498f9b4ffe86375172fea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 84111cdd1..eff73d8a4 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -386,7 +386,9 @@ def fix_variables(props, line):
if not isinstance(ann, ResultVariable):
continue
# We move the variable to the end and remove it.
- retvars.append(ann.type)
+ # PYSIDE-1409: If the variable was the first arg, we move it to the front.
+ # XXX This algorithm should probably be replaced by more introspection.
+ retvars.insert(0 if idx == 0 else len(retvars), ann.type)
deletions.append(idx)
del annos[name]
for idx in reversed(deletions):