Show More
@@ -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 = |
|
|
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 = |
|
|
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= |
|
|
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 = |
|
|
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