diff options
3 files changed, 9 insertions, 5 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index c06f072d1..e41ae5b80 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -2301,7 +2301,7 @@ void CppGenerator::writeErrorSection(QTextStream &s, OverloadData &overloadData) const AbstractMetaFunction *rfunc = overloadData.referenceFunction(); s << Qt::endl << INDENT << cpythonFunctionName(rfunc) << "_TypeError:\n"; Indentation indentation(INDENT); - QString funcName = fullPythonFunctionName(rfunc); + QString funcName = fullPythonFunctionName(rfunc, true); QString argsVar = pythonFunctionWrapperUsesListOfArguments(overloadData) ? QLatin1String("args") : QLatin1String(PYTHON_ARG); diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index 09c9cc501..328ca3a08 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -363,7 +363,7 @@ QString ShibokenGenerator::fullPythonClassName(const AbstractMetaClass *metaClas return fullClassName; } -QString ShibokenGenerator::fullPythonFunctionName(const AbstractMetaFunction *func) +QString ShibokenGenerator::fullPythonFunctionName(const AbstractMetaFunction *func, bool forceFunc) { QString funcName; if (func->isOperatorOverload()) @@ -372,10 +372,14 @@ QString ShibokenGenerator::fullPythonFunctionName(const AbstractMetaFunction *fu funcName = func->name(); if (func->ownerClass()) { QString fullClassName = fullPythonClassName(func->ownerClass()); - if (func->isConstructor()) + if (func->isConstructor()) { funcName = fullClassName; - else + if (forceFunc) + funcName.append(QLatin1String(".__init__")); + } + else { funcName.prepend(fullClassName + QLatin1Char('.')); + } } else { funcName = packageName() + QLatin1Char('.') + func->name(); diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h index d2aaa5b1a..0fc872848 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.h +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h @@ -235,7 +235,7 @@ protected: QString wrapperName(const AbstractMetaClass *metaClass) const; QString fullPythonClassName(const AbstractMetaClass *metaClass); - QString fullPythonFunctionName(const AbstractMetaFunction *func); + QString fullPythonFunctionName(const AbstractMetaFunction *func, bool forceFunc=false); bool wrapperDiagnostics() const { return m_wrapperDiagnostics; } |
