##// END OF EJS Templates
Fix ultratb when there are non-ascii filenames present in a traceback...
Carlos Cordoba -
Show More
@@ -248,6 +248,7 b' def fix_frame_records_filenames(records):'
248 # Look inside the frame's globals dictionary for __file__,
248 # Look inside the frame's globals dictionary for __file__,
249 # which should be better. However, keep Cython filenames since
249 # which should be better. However, keep Cython filenames since
250 # we prefer the source filenames over the compiled .so file.
250 # we prefer the source filenames over the compiled .so file.
251 filename = py3compat.cast_unicode(filename, "utf-8")
251 if not filename.endswith(('.pyx', '.pxd', '.pxi')):
252 if not filename.endswith(('.pyx', '.pxd', '.pxi')):
252 better_fn = frame.f_globals.get('__file__', None)
253 better_fn = frame.f_globals.get('__file__', None)
253 if isinstance(better_fn, str):
254 if isinstance(better_fn, str):
@@ -539,9 +540,9 b' class ListTB(TBTools):'
539 list = []
540 list = []
540 for filename, lineno, name, line in extracted_list[:-1]:
541 for filename, lineno, name, line in extracted_list[:-1]:
541 item = ' File %s"%s"%s, line %s%d%s, in %s%s%s\n' % \
542 item = ' File %s"%s"%s, line %s%d%s, in %s%s%s\n' % \
542 (Colors.filename, filename, Colors.Normal,
543 (Colors.filename, py3compat.cast_unicode(filename, "utf-8"), Colors.Normal,
543 Colors.lineno, lineno, Colors.Normal,
544 Colors.lineno, lineno, Colors.Normal,
544 Colors.name, name, Colors.Normal)
545 Colors.name, py3compat.cast_unicode(name, "utf-8"), Colors.Normal)
545 if line:
546 if line:
546 item += ' %s\n' % line.strip()
547 item += ' %s\n' % line.strip()
547 list.append(item)
548 list.append(item)
@@ -549,9 +550,9 b' class ListTB(TBTools):'
549 filename, lineno, name, line = extracted_list[-1]
550 filename, lineno, name, line = extracted_list[-1]
550 item = '%s File %s"%s"%s, line %s%d%s, in %s%s%s%s\n' % \
551 item = '%s File %s"%s"%s, line %s%d%s, in %s%s%s%s\n' % \
551 (Colors.normalEm,
552 (Colors.normalEm,
552 Colors.filenameEm, filename, Colors.normalEm,
553 Colors.filenameEm, py3compat.cast_unicode(filename, "utf-8"), Colors.normalEm,
553 Colors.linenoEm, lineno, Colors.normalEm,
554 Colors.linenoEm, lineno, Colors.normalEm,
554 Colors.nameEm, name, Colors.normalEm,
555 Colors.nameEm, py3compat.cast_unicode(name, "utf-8"), Colors.normalEm,
555 Colors.Normal)
556 Colors.Normal)
556 if line:
557 if line:
557 item += '%s %s%s\n' % (Colors.line, line.strip(),
558 item += '%s %s%s\n' % (Colors.line, line.strip(),
General Comments 0
You need to be logged in to leave comments. Login now