Show More
@@ -120,7 +120,6 b' from IPython.utils import PyColorize' | |||||
120 | from IPython.utils import openpy |
|
120 | from IPython.utils import openpy | |
121 | from IPython.utils import path as util_path |
|
121 | from IPython.utils import path as util_path | |
122 | from IPython.utils import py3compat |
|
122 | from IPython.utils import py3compat | |
123 | from IPython.utils import ulinecache |
|
|||
124 | from IPython.utils.data import uniq_stable |
|
123 | from IPython.utils.data import uniq_stable | |
125 | from IPython.utils.terminal import get_terminal_size |
|
124 | from IPython.utils.terminal import get_terminal_size | |
126 | from logging import info, error |
|
125 | from logging import info, error | |
@@ -370,7 +369,7 b' def _fixed_getinnerframes(etb, context=1, tb_offset=0):' | |||||
370 | maybeStart = lnum - 1 - context // 2 |
|
369 | maybeStart = lnum - 1 - context // 2 | |
371 | start = max(maybeStart, 0) |
|
370 | start = max(maybeStart, 0) | |
372 | end = start + context |
|
371 | end = start + context | |
373 |
lines = |
|
372 | lines = linecache.getlines(file)[start:end] | |
374 | buf = list(records[i]) |
|
373 | buf = list(records[i]) | |
375 | buf[LNUM_POS] = lnum |
|
374 | buf[LNUM_POS] = lnum | |
376 | buf[INDEX_POS] = lnum - 1 - start |
|
375 | buf[INDEX_POS] = lnum - 1 - start | |
@@ -706,7 +705,7 b' class ListTB(TBTools):' | |||||
706 | if not value.filename: value.filename = "<string>" |
|
705 | if not value.filename: value.filename = "<string>" | |
707 | if value.lineno: |
|
706 | if value.lineno: | |
708 | lineno = value.lineno |
|
707 | lineno = value.lineno | |
709 |
textline = |
|
708 | textline = linecache.getline(value.filename, value.lineno) | |
710 | else: |
|
709 | else: | |
711 | lineno = 'unknown' |
|
710 | lineno = 'unknown' | |
712 | textline = '' |
|
711 | textline = '' | |
@@ -922,7 +921,7 b' class VerboseTB(TBTools):' | |||||
922 | # E.g. https://github.com/ipython/ipython/issues/9486 |
|
921 | # E.g. https://github.com/ipython/ipython/issues/9486 | |
923 | return '%s %s\n' % (link, call) |
|
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 | line = getline(file, lnum[0]) |
|
925 | line = getline(file, lnum[0]) | |
927 | lnum[0] += 1 |
|
926 | lnum[0] += 1 | |
928 | return line |
|
927 | return line | |
@@ -1413,7 +1412,7 b' class SyntaxTB(ListTB):' | |||||
1413 | and isinstance(value.filename, str) \ |
|
1412 | and isinstance(value.filename, str) \ | |
1414 | and isinstance(value.lineno, int): |
|
1413 | and isinstance(value.lineno, int): | |
1415 | linecache.checkcache(value.filename) |
|
1414 | linecache.checkcache(value.filename) | |
1416 |
newtext = |
|
1415 | newtext = linecache.getline(value.filename, value.lineno) | |
1417 | if newtext: |
|
1416 | if newtext: | |
1418 | value.text = newtext |
|
1417 | value.text = newtext | |
1419 | self.last_syntax_error = value |
|
1418 | self.last_syntax_error = value |
General Comments 0
You need to be logged in to leave comments.
Login now