aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/sbkdbg.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-10 14:41:03 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:22 -0300
commitce1d707bef6426a1f18f92ab729dc4d89fbe63e4 (patch)
tree7be0f9f2cfe39545d009806d1ce6ac300c915e5f /libshiboken/sbkdbg.h
parent7327989fb85595d1795c1dbd013428b8909b2f0a (diff)
Improved the SbkDbg to avoid throwing exceptions when showing an object.
Also added a new Shiboken::Object::isValid signature to help. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'libshiboken/sbkdbg.h')
-rw-r--r--libshiboken/sbkdbg.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libshiboken/sbkdbg.h b/libshiboken/sbkdbg.h
index 863ce6de1..7c2bd6030 100644
--- a/libshiboken/sbkdbg.h
+++ b/libshiboken/sbkdbg.h
@@ -24,6 +24,7 @@
#define SBKDBG_H
#include <Python.h>
+#include "basewrapper.h"
#include <iostream>
#ifndef NOCOLOR
@@ -68,7 +69,7 @@ private:
inline std::ostream& operator<<(std::ostream& out, PyObject* obj)
{
- PyObject* repr = PyObject_Repr(obj);
+ PyObject* repr = Shiboken::Object::isValid(obj, false) ? PyObject_Repr(obj) : 0;
if (repr) {
out << PyString_AS_STRING(repr);
Py_DECREF(repr);