aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.cpp3
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp7
2 files changed, 2 insertions, 8 deletions
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.cpp b/sources/shiboken6/generator/shiboken/overloaddata.cpp
index f315c9d3f..5ad2087d3 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.cpp
+++ b/sources/shiboken6/generator/shiboken/overloaddata.cpp
@@ -752,7 +752,8 @@ int OverloadData::numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func,
{
Q_ASSERT(finalArgPos >= 0);
int removed = 0;
- for (int i = 0; i < finalArgPos + removed; ++i) {
+ const int size = func->arguments().size();
+ for (int i = 0; i < qMin(size, finalArgPos + removed); ++i) {
if (func->argumentRemoved(i + 1))
++removed;
}
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 822c4d2fb..faeb860f6 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -1650,13 +1650,6 @@ void ShibokenGenerator::writeCodeSnips(TextStream &s,
if (code.isEmpty())
return;
- // Calculate the real number of arguments.
- int argsRemoved = 0;
- for (int i = 0; i < func->arguments().size(); i++) {
- if (func->argumentRemoved(i+1))
- argsRemoved++;
- }
-
// Replace %PYARG_# variables.
replacePyArg0(language, &code);