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