summaryrefslogtreecommitdiffstats
path: root/libpython.py
diff options
context:
space:
mode:
Diffstat (limited to 'libpython.py')
-rw-r--r--libpython.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/libpython.py b/libpython.py
index b04f522..c42e0fd 100644
--- a/libpython.py
+++ b/libpython.py
@@ -219,6 +219,15 @@ class PyTypeObjectPtr(PyObjectPtr):
def int_from_int(gdbval):
return int(str(gdbval))
+def stringify(val):
+ # TODO: repr() puts everything on one line; pformat can be nicer, but
+ # can lead to v.long results; this function isolates the choice
+ if True:
+ return repr(val)
+ else:
+ from pprint import pformat
+ return pformat(val)
+
class FrameInfo:
'''
Class representing all of the information we can scrape about a
@@ -249,7 +258,7 @@ class FrameInfo:
% (self.co_filename,
self.f_lineno,
self.co_name,
- ', '.join(['%s=%s' % (k, repr(v)) for k, v in self.locals]))
+ ', '.join(['%s=%s' % (k, stringify(v)) for k, v in self.locals]))
)
@@ -293,7 +302,7 @@ class PyObjectPtrPrinter:
def to_string (self):
proxyval = PyObjectPtr.from_pyobject_ptr(self.gdbval).proxyval()
- return repr(proxyval)
+ return stringify(proxyval)
class PyFrameObjectPtrPrinter(PyObjectPtrPrinter):
"Prints a (PyFrameObject*)"