Skip to content

Commit

Permalink
Fix for going into the debugger with non-ascii filenames.
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Aug 18, 2012
1 parent 55f4e91 commit c4aa78f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions IPython/core/debugger.py
Expand Up @@ -32,7 +32,7 @@


from IPython.utils import PyColorize, ulinecache from IPython.utils import PyColorize, ulinecache
from IPython.core import ipapi from IPython.core import ipapi
from IPython.utils import coloransi, io, openpy from IPython.utils import coloransi, io, openpy, py3compat
from IPython.core.excolors import exception_colors from IPython.core.excolors import exception_colors


# See if we can use pydb. # See if we can use pydb.
Expand Down Expand Up @@ -310,10 +310,10 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):


Colors = self.color_scheme_table.active_colors Colors = self.color_scheme_table.active_colors
ColorsNormal = Colors.Normal ColorsNormal = Colors.Normal
tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal) tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal)
tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal) tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
ColorsNormal) ColorsNormal)


frame, lineno = frame_lineno frame, lineno = frame_lineno
Expand All @@ -327,7 +327,7 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):


#s = filename + '(' + `lineno` + ')' #s = filename + '(' + `lineno` + ')'
filename = self.canonic(frame.f_code.co_filename) filename = self.canonic(frame.f_code.co_filename)
link = tpl_link % filename link = tpl_link % py3compat.cast_unicode(filename)


if frame.f_code.co_name: if frame.f_code.co_name:
func = frame.f_code.co_name func = frame.f_code.co_name
Expand All @@ -348,7 +348,7 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
ret.append('> ') ret.append('> ')
else: else:
ret.append(' ') ret.append(' ')
ret.append('%s(%s)%s\n' % (link,lineno,call)) ret.append(u'%s(%s)%s\n' % (link,lineno,call))


start = lineno - 1 - context//2 start = lineno - 1 - context//2
lines = ulinecache.getlines(filename) lines = ulinecache.getlines(filename)
Expand Down Expand Up @@ -425,7 +425,7 @@ def print_list_lines(self, filename, first, last):
filename = self._exec_filename filename = self._exec_filename


for lineno in range(first, last+1): for lineno in range(first, last+1):
ulinecache.getline(filename, lineno) line = ulinecache.getline(filename, lineno)
if not line: if not line:
break break


Expand Down

0 comments on commit c4aa78f

Please sign in to comment.