diff options
Diffstat (limited to 'PySide/QtCore/typesystem_core.xml')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index edd4facd1..863c05634 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1534,12 +1534,13 @@ </extra-includes> <add-function signature="__repr__" return-type="PyObject*"> <inject-code class="target" position="beginning"> - PyObject* str = PyString_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size()); - <insert-template name="repr_code"> - <replace from="%REPR_FORMAT" to="'%s'" /> - <replace from="%REPR_ARGS" to="PyString_AS_STRING(str)" /> - </insert-template> - Py_DECREF(str); + QByteArray b(((PyObject*)%PYSELF)->ob_type->tp_name); + b += "(\""; + QByteArray contents(*%CPPSELF); + contents.replace("\"", "\\\""); + b += contents; + b += "\")"; + %PYARG_0 = PyString_FromStringAndSize(b.constData(), b.size()); </inject-code> </add-function> @@ -1710,9 +1711,9 @@ <insert-template name="fix_bool*"/> </inject-code> </modify-function> - <add-function signature="__str__()" return-type="PyObject*"> + <add-function signature="__str__" return-type="PyObject*"> <inject-code class="target" position="beginning"> - %PYARG_0 = PyString_FromString(%CPPSELF.data()); + %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size()); </inject-code> </add-function> <add-function signature="__len__"> |