Show More
@@ -1055,27 +1055,8 b' class VerboseTB(TBTools):' | |||
|
1055 | 1055 | etype, evalue = str, sys.exc_info()[:2] |
|
1056 | 1056 | etype_str, evalue_str = map(str, (etype, evalue)) |
|
1057 | 1057 | # ... and format it |
|
1058 |
|
|
|
1059 |
|
|
|
1060 | ||
|
1061 | if (not py3compat.PY3) and type(evalue) is types.InstanceType: | |
|
1062 | try: | |
|
1063 | names = [w for w in dir(evalue) if isinstance(w, str)] | |
|
1064 | except: | |
|
1065 | # Every now and then, an object with funny internals blows up | |
|
1066 | # when dir() is called on it. We do the best we can to report | |
|
1067 | # the problem and continue | |
|
1068 | _m = '%sException reporting error (object with broken dir())%s:' | |
|
1069 | exception.append(_m % (colors.excName, colorsnormal)) | |
|
1070 | etype_str, evalue_str = map(str, sys.exc_info()[:2]) | |
|
1071 | exception.append('%s%s%s: %s' % (colors.excName, etype_str, | |
|
1072 | colorsnormal, py3compat.cast_unicode(evalue_str))) | |
|
1073 | names = [] | |
|
1074 | for name in names: | |
|
1075 | value = text_repr(getattr(evalue, name)) | |
|
1076 | exception.append('\n%s%s = %s' % (indent, name, value)) | |
|
1077 | ||
|
1078 | return exception | |
|
1058 | return ['%s%s%s: %s' % (colors.excName, etype_str, | |
|
1059 | colorsnormal, py3compat.cast_unicode(evalue_str))] | |
|
1079 | 1060 | |
|
1080 | 1061 | def format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset): |
|
1081 | 1062 | """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