Commit f960367e authored by Mark Florisson's avatar Mark Florisson

Fix converting a remote PyStringObject to a local string

parent 2aadadd0
......@@ -244,13 +244,8 @@ class CythonBase(object):
if not pyframeobject:
raise gdb.GdbError('Unable to read information on python frame')
try:
filename = pyframeobject.filename()
except RuntimeError:
filename = None
lineno = None
else:
lineno = pyframeobject.current_line_num()
filename = pyframeobject.filename()
lineno = pyframeobject.current_line_num()
if pygments:
lexer = pygments.lexers.PythonLexer(stripall=False)
......@@ -313,10 +308,7 @@ class CythonBase(object):
# print this python function as a C function
return self.print_stackframe(frame, index, is_c=True)
try:
func_name = str(pyframe.co_name)
except RuntimeError:
func_name = 'Unknown Function Name'
func_name = pyframe.co_name
func_cname = 'PyEval_EvalFrameEx'
func_args = []
elif self.is_cython_function(frame):
......
......@@ -975,7 +975,9 @@ class PyStringObjectPtr(PyObjectPtr):
def __str__(self):
field_ob_size = self.field('ob_size')
field_ob_sval = self.field('ob_sval')
char_ptr = field_ob_sval.address.cast(_type_unsigned_char_ptr)
char_ptr = field_ob_sval.address.cast(
gdb.lookup_type('char').pointer())
return ''.join([chr(char_ptr[i]) for i in safe_range(field_ob_size)])
def proxyval(self, visited):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment