aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-09-20 19:29:12 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:15 -0300
commit2d8f8d8ac79bc6f266564afd7d0ffe702a7cdf58 (patch)
treed23a3316ae0382685fb6150ca5261b387a5b4ec7 /libshiboken
parent0b1f8df512047c6ace60701180ec1e4f6e97484e (diff)
Fix SbkDbg() << PyObject on Python 3.x
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 {