##// END OF EJS Templates
Quick fix for #1688, traceback-unicode issue...
Jörgen Stenarson -
Show More
@@ -69,7 +69,7 b' possible inclusion in future releases.'
69 69 # the file COPYING, distributed as part of this software.
70 70 #*****************************************************************************
71 71
72 from __future__ import with_statement
72 from __future__ import unicode_literals
73 73
74 74 import inspect
75 75 import keyword
@@ -99,6 +99,7 b' from IPython.core.display_trap import DisplayTrap'
99 99 from IPython.core.excolors import exception_colors
100 100 from IPython.utils import PyColorize
101 101 from IPython.utils import io
102 from IPython.utils import path as util_path
102 103 from IPython.utils import py3compat
103 104 from IPython.utils import pyfile
104 105 from IPython.utils.data import uniq_stable
@@ -282,12 +283,7 b' def _format_traceback_lines(lnum, index, lines, Colors, lvals=None,scheme=None):'
282 283 _line_format = _parser.format2
283 284
284 285 for line in lines:
285 # FIXME: we need to ensure the source is a pure string at this point,
286 # else the coloring code makes a royal mess. This is in need of a
287 # serious refactoring, so that all of the ultratb and PyColorize code
288 # is unicode-safe. So for now this is rather an ugly hack, but
289 # necessary to at least have readable tracebacks. Improvements welcome!
290 line = py3compat.cast_bytes_py2(line, 'utf-8')
286 line = py3compat.cast_unicode(line)
291 287
292 288 new_line, err = _line_format(line, 'str', scheme)
293 289 if not err: line = new_line
@@ -779,7 +775,6 b' class VerboseTB(TBTools):'
779 775 abspath = os.path.abspath
780 776 for frame, file, lnum, func, lines, index in records:
781 777 #print '*** record:',file,lnum,func,lines,index # dbg
782
783 778 if not file:
784 779 file = '?'
785 780 elif not(file.startswith("<") and file.endswith(">")):
@@ -791,7 +786,7 b' class VerboseTB(TBTools):'
791 786 # Not sure if this can still happen: abspath now works with
792 787 # file names like <string>
793 788 pass
794
789 file = py3compat.cast_unicode(file, util_path.fs_encoding)
795 790 link = tpl_link % file
796 791 args, varargs, varkw, locals = inspect.getargvalues(frame)
797 792
@@ -30,6 +30,8 b' formatting (which is the hard part).'
30 30 """
31 31 from __future__ import print_function
32 32
33 from __future__ import unicode_literals
34
33 35 __all__ = ['ANSICodeColors','Parser']
34 36
35 37 _scheme_default = 'Linux'
General Comments 0
You need to be logged in to leave comments. Login now