Skip to content

Commit

Permalink
Cast exception.value to unicode.
Browse files Browse the repository at this point in the history
For instance Windows IO error messages are localized and may contain
non-ascii chracters.
  • Loading branch information
jstenar committed Aug 28, 2012
1 parent 50c631d commit 8ed4178
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IPython/core/ultratb.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ def linereader(file=file, lnum=[lnum], getline=ulinecache.getline):
etype_str,evalue_str = map(str,(etype,evalue))
# ... and format it
exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
ColorsNormal, evalue_str)]
ColorsNormal, py3compat.cast_unicode(evalue_str))]
if (not py3compat.PY3) and type(evalue) is types.InstanceType:
try:
names = [w for w in dir(evalue) if isinstance(w, basestring)]
Expand All @@ -937,7 +937,7 @@ def linereader(file=file, lnum=[lnum], getline=ulinecache.getline):
exception.append(_m % (Colors.excName,ColorsNormal))
etype_str,evalue_str = map(str,sys.exc_info()[:2])
exception.append('%s%s%s: %s' % (Colors.excName,etype_str,
ColorsNormal, evalue_str))
ColorsNormal, py3compat.cast_unicode(evalue_str)))
names = []
for name in names:
value = text_repr(getattr(evalue, name))
Expand Down

0 comments on commit 8ed4178

Please sign in to comment.