diff options
author | Christian Tismer <tismer@stackless.com> | 2020-08-20 17:48:25 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-08-24 12:24:35 +0200 |
commit | acb54ac2235199cbb710799d7934e56737bacfbb (patch) | |
tree | da9dcc722e7d52331e64983f1543571bfaea3e73 /sources/shiboken2/generator | |
parent | b8663129f275e2a1648090cf42c3bc673fad956c (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/generator')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 260607479..73f1a10cf 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -4683,6 +4683,10 @@ void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunction for (const AbstractMetaFunction *f : overloads) { QStringList args; + // PYSIDE-1328: `self`-ness cannot be computed in Python because there are mixed cases. + // Toplevel functions like `PySide2.QtCore.QEnum` are always self-less. + if (!(f->isStatic()) && f->ownerClass()) + args << QLatin1String("self"); const AbstractMetaArgumentList &arguments = f->arguments(); for (const AbstractMetaArgument *arg : arguments) { QString strArg = arg->type()->pythonSignature(); |