aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorAndreas Beckermann <beckermann@monument-software.de>2019-09-12 14:56:35 +0200
committerAndreas Beckermann <beckermann@monument-software.de>2019-09-27 08:24:28 +0200
commit45fdb9c06d8934e5c8de208e584d4c35943cd3b8 (patch)
tree3b3751e80a5f936de51592c14c717c3c5b7a236d /sources
parent35bc1078b4c130cd24282ce6c770c195b1cfd76f (diff)
Remove trailing whitespace from __repr__
QDebug normally prints a trailing ' ', however the repr implementation does not expect so. Remove the trailing space, if it is there. This makes sure that e.g. PySide2.QtCore.QRegularExpression() is printed as <PySide2.QtCore.QRegularExpression("", QRegularExpression::PatternOptions("NoPatternOption")) at 0x1067a5d20> instead of <PySide2.QtCore.QRegularExpression("", QRegularExpression::PatternOptions("NoPatternOption")) at 0x1067a5d20> (note the double space before 'at') Change-Id: I6c088069a6a8ca42933a442cce7b576327a9d151 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 68bcfe508..7de0cfc09 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -6030,6 +6030,7 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex
Indentation indent(INDENT);
s << INDENT << "str.replace(0, idx, Py_TYPE(self)->tp_name);" << endl;
}
+ s << INDENT << "str = str.trimmed();" << endl;
s << INDENT << "PyObject *mod = PyDict_GetItemString(Py_TYPE(self)->tp_dict, \"__module__\");" << endl;
// PYSIDE-595: The introduction of heap types has the side effect that the module name
// is always prepended to the type name. Therefore the strchr check: