aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkdbg.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libshiboken/sbkdbg.h b/libshiboken/sbkdbg.h
index b671caeab..e5413c076 100644
--- a/libshiboken/sbkdbg.h
+++ b/libshiboken/sbkdbg.h
@@ -71,6 +71,11 @@ inline std::ostream& operator<<(std::ostream& out, PyObject* obj)
{
PyObject* repr = Shiboken::Object::isValid(obj, false) ? PyObject_Repr(obj) : 0;
if (repr) {
+#ifdef IS_PY3K
+ PyObject* str = PyUnicode_AsUTF8String(repr);
+ Py_DECREF(repr);
+ repr = str;
+#endif
out << PyBytes_AS_STRING(repr);
Py_DECREF(repr);
} else {