Show More
@@ -381,6 +381,8 b' def _format_traceback_lines(lnum, index, lines, Colors, lvals=None, _line_forma' | |||
|
381 | 381 | i = lnum - index |
|
382 | 382 | |
|
383 | 383 | for line in lines: |
|
384 | line = py3compat.cast_unicode(line) | |
|
385 | ||
|
384 | 386 | new_line, err = _line_format(line, 'str') |
|
385 | 387 | if not err: line = new_line |
|
386 | 388 | |
@@ -685,7 +687,7 b' class ListTB(TBTools):' | |||
|
685 | 687 | have_filedata = False |
|
686 | 688 | Colors = self.Colors |
|
687 | 689 | list = [] |
|
688 | stype = Colors.excName + etype.__name__ + Colors.Normal | |
|
690 | stype = py3compat.cast_unicode(Colors.excName + etype.__name__ + Colors.Normal) | |
|
689 | 691 | if value is None: |
|
690 | 692 | # Not sure if this can still happen in Python 2.6 and above |
|
691 | 693 | list.append(stype + '\n') |
@@ -701,10 +703,10 b' class ListTB(TBTools):' | |||
|
701 | 703 | textline = '' |
|
702 | 704 | list.append('%s File %s"%s"%s, line %s%s%s\n' % \ |
|
703 | 705 | (Colors.normalEm, |
|
704 | Colors.filenameEm, value.filename, Colors.normalEm, | |
|
706 | Colors.filenameEm, py3compat.cast_unicode(value.filename), Colors.normalEm, | |
|
705 | 707 | Colors.linenoEm, lineno, Colors.Normal )) |
|
706 | 708 | if textline == '': |
|
707 | textline = value.text | |
|
709 | textline = py3compat.cast_unicode(value.text, "utf-8") | |
|
708 | 710 | |
|
709 | 711 | if textline is not None: |
|
710 | 712 | i = 0 |
@@ -769,7 +771,7 b' class ListTB(TBTools):' | |||
|
769 | 771 | def _some_str(self, value): |
|
770 | 772 | # Lifted from traceback.py |
|
771 | 773 | try: |
|
772 | return str(value) | |
|
774 | return py3compat.cast_unicode(str(value)) | |
|
773 | 775 | except: |
|
774 | 776 | return u'<unprintable %s object>' % type(value).__name__ |
|
775 | 777 | |
@@ -866,6 +868,7 b' class VerboseTB(TBTools):' | |||
|
866 | 868 | # strange entries... |
|
867 | 869 | pass |
|
868 | 870 | |
|
871 | file = py3compat.cast_unicode(file, util_path.fs_encoding) | |
|
869 | 872 | link = tpl_link % util_path.compress_user(file) |
|
870 | 873 | args, varargs, varkw, locals = inspect.getargvalues(frame) |
|
871 | 874 | |
@@ -1043,7 +1046,8 b' class VerboseTB(TBTools):' | |||
|
1043 | 1046 | etype, evalue = str, sys.exc_info()[:2] |
|
1044 | 1047 | etype_str, evalue_str = map(str, (etype, evalue)) |
|
1045 | 1048 | # ... and format it |
|
1046 |
return ['%s%s%s: %s' % (colors.excName, etype_str, |
|
|
1049 | return ['%s%s%s: %s' % (colors.excName, etype_str, | |
|
1050 | colorsnormal, py3compat.cast_unicode(evalue_str))] | |
|
1047 | 1051 | |
|
1048 | 1052 | def format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset): |
|
1049 | 1053 | """Formats the header, traceback and exception message for a single exception. |
General Comments 0
You need to be logged in to leave comments.
Login now