Permalink
Browse files

Fix for going into the debugger with non-ascii filenames.

  • Loading branch information...
1 parent 55f4e91 commit c4aa78f38d8af868bd943b9c21cf3608df90dcaa @takluyver committed Aug 18, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 IPython/core/debugger.py
View
@@ -32,7 +32,7 @@
from IPython.utils import PyColorize, ulinecache
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
# See if we can use pydb.
@@ -310,10 +310,10 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
Colors = self.color_scheme_table.active_colors
ColorsNormal = Colors.Normal
- tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
- tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
- tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
- tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
+ tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal)
+ tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
+ tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
+ tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
ColorsNormal)
frame, lineno = frame_lineno
@@ -327,7 +327,7 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
#s = filename + '(' + `lineno` + ')'
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:
func = frame.f_code.co_name
@@ -348,7 +348,7 @@ def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
ret.append('> ')
else:
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
lines = ulinecache.getlines(filename)
@@ -425,7 +425,7 @@ def print_list_lines(self, filename, first, last):
filename = self._exec_filename
for lineno in range(first, last+1):
- ulinecache.getline(filename, lineno)
+ line = ulinecache.getline(filename, lineno)
if not line:
break

0 comments on commit c4aa78f

Please sign in to comment.