aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-08-20 17:48:25 +0200
committerChristian Tismer <tismer@stackless.com>2020-08-24 12:24:35 +0200
commitacb54ac2235199cbb710799d7934e56737bacfbb (patch)
treeda9dcc722e7d52331e64983f1543571bfaea3e73 /sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py
parentb8663129f275e2a1648090cf42c3bc673fad956c (diff)
signature: pass `self` directly from parser
The signature module took the info from the PyCFunction flags for a long time to check if something is a function, method or staticmethod. It turned out that there are functions with multiple signatures where the method/staticmethod info varies in the signatures. This invalidated the PyCFunction flag usage. Instead, we now compute that info directly from abstractmetalang.cpp which has access to the correct info. Fixes: PYSIDE-1328 Change-Id: I6ba7237efcc486de014184b1787d05d87bee5a5e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py')
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py
index 384273d92..51ce60bfa 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/layout.py
@@ -231,17 +231,14 @@ def create_signature(props, key):
# this is the basic layout of a signature
varnames = props["varnames"]
if layout.definition:
- if sig_kind == "function":
- pass
- elif sig_kind == "method":
- varnames = ("self",) + varnames
- elif sig_kind == "staticmethod":
- pass
- elif sig_kind == "classmethod":
- varnames = ("klass",) + varnames
- else:
- raise SystemError("Methods must be function, method, staticmethod"
- " or classmethod")
+ # PYSIDE-1328: We no longer use info from the sig_kind which is
+ # more complex for multiple signatures. We now get `self` from the
+ # parser.
+ pass
+ else:
+ if "self" in varnames[:1]:
+ varnames = varnames[1:]
+
# calculate the modifications
defaults = props["defaults"][:]
if not layout.defaults:
@@ -259,6 +256,8 @@ def create_signature(props, key):
elif name.startswith("*"):
kind = _VAR_POSITIONAL
ann = annotations.get(name, _empty)
+ if ann == "self":
+ ann = _empty
name = name.lstrip("*")
defpos = idx - len(varnames) + len(defaults)
default = defaults[defpos] if defpos >= 0 else _empty