aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-11-28 14:55:50 +0100
committerChristian Tismer <tismer@stackless.com>2020-11-30 16:28:46 +0100
commit3d137f78105fe71bffeabfd6dd763b5502c58cf5 (patch)
tree5c09c2190027e1b8717c0bb94ff01a616885ba04
parent2787bbf0042d7c8c1ee39ead6c10576994b3ed53 (diff)
cppgenerator: rework keyword handling regarding unknown.. augmented
The new keyword algorithm did fail on Windows. There was a wrong calculation of the number of arguments left over from the old algorithm. This was only visible on windows, because it generates slightly different signatures for QtGui.QColor. Change-Id: I5aee3e7c722c8365f86bf6196ab1fd3cf5bb46ad Fixes: PYSIDE-1305 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit d55a0ffb6b7ed154f5971c71b29621b532a394f5)
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 05d9d97d6..30430c01f 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -1845,9 +1845,6 @@ void CppGenerator::writeMethodWrapperPreamble(QTextStream &s, OverloadData &over
writeUnusedVariableCast(s, QLatin1String(PYTHON_TO_CPP_VAR));
}
- if (usesNamedArguments && !rfunc->isCallOperator())
- s << INDENT << "const Py_ssize_t numNamedArgs = (kwds ? PyDict_Size(kwds) : 0);\n";
-
if (initPythonArguments) {
s << INDENT << "const Py_ssize_t numArgs = ";
if (minArgs == 0 && maxArgs == 1 && !rfunc->isConstructor() && !pythonFunctionWrapperUsesListOfArguments(overloadData))
@@ -2149,7 +2146,7 @@ void CppGenerator::writeArgumentsInitializer(QTextStream &s, OverloadData &overl
bool ownerClassIsQObject = rfunc->ownerClass() && rfunc->ownerClass()->isQObject() && rfunc->isConstructor();
if (usesNamedArguments) {
if (!ownerClassIsQObject) {
- s << INDENT << "if (numArgs" << (overloadData.hasArgumentWithDefaultValue() ? " + numNamedArgs" : "") << " > " << maxArgs << ") {\n";
+ s << INDENT << "if (numArgs > " << maxArgs << ") {\n";
{
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_TypeError, \"" << fullPythonFunctionName(rfunc) << "(): too many arguments\");\n";