aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 393f8a850..adec70dd7 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -1764,6 +1764,7 @@ void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunction
s << endl;
/*
+ * This code is intended for shift operations only:
* Make sure reverse <</>> operators defined in other classes (specially from other modules)
* are called. A proper and generic solution would require an reengineering in the operator
* system like the extended converters.
@@ -1778,7 +1779,9 @@ void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunction
&& rfunc->isOperatorOverload();
if (callExtendedReverseOperator) {
QString revOpName = ShibokenGenerator::pythonOperatorFunctionName(rfunc).insert(2, QLatin1Char('r'));
- if (rfunc->isBinaryOperator()) {
+ // For custom classes, operations like __radd__ and __rmul__
+ // will enter an infinite loop.
+ if (rfunc->isBinaryOperator() && revOpName.contains(QLatin1String("shift"))) {
s << INDENT << "if (!isReverse" << endl;
{
Indentation indent(INDENT);