##// END OF EJS Templates
Merge pull request #10141 from srinivasreddy/uline_cache...
Matthias Bussonnier -
r23121:ff9d2381 merge
parent child Browse files
Show More
@@ -28,11 +28,12 b' http://www.python.org/2.2.3/license.html"""'
28 28 import bdb
29 29 import functools
30 30 import inspect
31 import linecache
31 32 import sys
32 33 import warnings
33 34
34 35 from IPython import get_ipython
35 from IPython.utils import PyColorize, ulinecache
36 from IPython.utils import PyColorize
36 37 from IPython.utils import coloransi, py3compat
37 38 from IPython.core.excolors import exception_colors
38 39 from IPython.testing.skipdoctest import skip_doctest
@@ -407,7 +408,7 b' class Pdb(OldPdb):'
407 408 ret.append(u'%s(%s)%s\n' % (link,lineno,call))
408 409
409 410 start = lineno - 1 - context//2
410 lines = ulinecache.getlines(filename)
411 lines = linecache.getlines(filename)
411 412 start = min(start, len(lines) - context)
412 413 start = max(start, 0)
413 414 lines = lines[start : start + context]
@@ -466,7 +467,7 b' class Pdb(OldPdb):'
466 467 filename = self._exec_filename
467 468
468 469 for lineno in range(first, last+1):
469 line = ulinecache.getline(filename, lineno)
470 line = linecache.getline(filename, lineno)
470 471 if not line:
471 472 break
472 473
@@ -120,7 +120,6 b' from IPython.utils import PyColorize'
120 120 from IPython.utils import openpy
121 121 from IPython.utils import path as util_path
122 122 from IPython.utils import py3compat
123 from IPython.utils import ulinecache
124 123 from IPython.utils.data import uniq_stable
125 124 from IPython.utils.terminal import get_terminal_size
126 125 from logging import info, error
@@ -370,7 +369,7 b' def _fixed_getinnerframes(etb, context=1, tb_offset=0):'
370 369 maybeStart = lnum - 1 - context // 2
371 370 start = max(maybeStart, 0)
372 371 end = start + context
373 lines = ulinecache.getlines(file)[start:end]
372 lines = linecache.getlines(file)[start:end]
374 373 buf = list(records[i])
375 374 buf[LNUM_POS] = lnum
376 375 buf[INDEX_POS] = lnum - 1 - start
@@ -706,7 +705,7 b' class ListTB(TBTools):'
706 705 if not value.filename: value.filename = "<string>"
707 706 if value.lineno:
708 707 lineno = value.lineno
709 textline = ulinecache.getline(value.filename, value.lineno)
708 textline = linecache.getline(value.filename, value.lineno)
710 709 else:
711 710 lineno = 'unknown'
712 711 textline = ''
@@ -922,7 +921,7 b' class VerboseTB(TBTools):'
922 921 # E.g. https://github.com/ipython/ipython/issues/9486
923 922 return '%s %s\n' % (link, call)
924 923
925 def linereader(file=file, lnum=[lnum], getline=ulinecache.getline):
924 def linereader(file=file, lnum=[lnum], getline=linecache.getline):
926 925 line = getline(file, lnum[0])
927 926 lnum[0] += 1
928 927 return line
@@ -1413,7 +1412,7 b' class SyntaxTB(ListTB):'
1413 1412 and isinstance(value.filename, str) \
1414 1413 and isinstance(value.lineno, int):
1415 1414 linecache.checkcache(value.filename)
1416 newtext = ulinecache.getline(value.filename, value.lineno)
1415 newtext = linecache.getline(value.filename, value.lineno)
1417 1416 if newtext:
1418 1417 value.text = newtext
1419 1418 self.last_syntax_error = value
General Comments 0
You need to be logged in to leave comments. Login now