##// END OF EJS Templates
Fix for going into the debugger with non-ascii filenames.
Thomas Kluyver -
Show More
@@ -32,7 +32,7 b' import sys'
32
32
33 from IPython.utils import PyColorize, ulinecache
33 from IPython.utils import PyColorize, ulinecache
34 from IPython.core import ipapi
34 from IPython.core import ipapi
35 from IPython.utils import coloransi, io, openpy
35 from IPython.utils import coloransi, io, openpy, py3compat
36 from IPython.core.excolors import exception_colors
36 from IPython.core.excolors import exception_colors
37
37
38 # See if we can use pydb.
38 # See if we can use pydb.
@@ -310,10 +310,10 b' class Pdb(OldPdb):'
310
310
311 Colors = self.color_scheme_table.active_colors
311 Colors = self.color_scheme_table.active_colors
312 ColorsNormal = Colors.Normal
312 ColorsNormal = Colors.Normal
313 tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
313 tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal)
314 tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
314 tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
315 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
315 tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
316 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
316 tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
317 ColorsNormal)
317 ColorsNormal)
318
318
319 frame, lineno = frame_lineno
319 frame, lineno = frame_lineno
@@ -327,7 +327,7 b' class Pdb(OldPdb):'
327
327
328 #s = filename + '(' + `lineno` + ')'
328 #s = filename + '(' + `lineno` + ')'
329 filename = self.canonic(frame.f_code.co_filename)
329 filename = self.canonic(frame.f_code.co_filename)
330 link = tpl_link % filename
330 link = tpl_link % py3compat.cast_unicode(filename)
331
331
332 if frame.f_code.co_name:
332 if frame.f_code.co_name:
333 func = frame.f_code.co_name
333 func = frame.f_code.co_name
@@ -348,7 +348,7 b' class Pdb(OldPdb):'
348 ret.append('> ')
348 ret.append('> ')
349 else:
349 else:
350 ret.append(' ')
350 ret.append(' ')
351 ret.append('%s(%s)%s\n' % (link,lineno,call))
351 ret.append(u'%s(%s)%s\n' % (link,lineno,call))
352
352
353 start = lineno - 1 - context//2
353 start = lineno - 1 - context//2
354 lines = ulinecache.getlines(filename)
354 lines = ulinecache.getlines(filename)
@@ -425,7 +425,7 b' class Pdb(OldPdb):'
425 filename = self._exec_filename
425 filename = self._exec_filename
426
426
427 for lineno in range(first, last+1):
427 for lineno in range(first, last+1):
428 ulinecache.getline(filename, lineno)
428 line = ulinecache.getline(filename, lineno)
429 if not line:
429 if not line:
430 break
430 break
431
431
General Comments 0
You need to be logged in to leave comments. Login now