From ff9d23819c1f93893d7e424ca84a002cad068c94 2017-01-08 19:18:10 From: Matthias Bussonnier Date: 2017-01-08 19:18:10 Subject: [PATCH] Merge pull request #10141 from srinivasreddy/uline_cache remove ulinecache module references and move them to linecache --- diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 447786f..4e47c67 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -28,11 +28,12 @@ http://www.python.org/2.2.3/license.html""" import bdb import functools import inspect +import linecache import sys import warnings from IPython import get_ipython -from IPython.utils import PyColorize, ulinecache +from IPython.utils import PyColorize from IPython.utils import coloransi, py3compat from IPython.core.excolors import exception_colors from IPython.testing.skipdoctest import skip_doctest @@ -407,7 +408,7 @@ class Pdb(OldPdb): ret.append(u'%s(%s)%s\n' % (link,lineno,call)) start = lineno - 1 - context//2 - lines = ulinecache.getlines(filename) + lines = linecache.getlines(filename) start = min(start, len(lines) - context) start = max(start, 0) lines = lines[start : start + context] @@ -466,7 +467,7 @@ class Pdb(OldPdb): filename = self._exec_filename for lineno in range(first, last+1): - line = ulinecache.getline(filename, lineno) + line = linecache.getline(filename, lineno) if not line: break diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index 3ccbb81..07b88dd 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -120,7 +120,6 @@ from IPython.utils import PyColorize from IPython.utils import openpy from IPython.utils import path as util_path from IPython.utils import py3compat -from IPython.utils import ulinecache from IPython.utils.data import uniq_stable from IPython.utils.terminal import get_terminal_size from logging import info, error @@ -370,7 +369,7 @@ def _fixed_getinnerframes(etb, context=1, tb_offset=0): maybeStart = lnum - 1 - context // 2 start = max(maybeStart, 0) end = start + context - lines = ulinecache.getlines(file)[start:end] + lines = linecache.getlines(file)[start:end] buf = list(records[i]) buf[LNUM_POS] = lnum buf[INDEX_POS] = lnum - 1 - start @@ -706,7 +705,7 @@ class ListTB(TBTools): if not value.filename: value.filename = "" if value.lineno: lineno = value.lineno - textline = ulinecache.getline(value.filename, value.lineno) + textline = linecache.getline(value.filename, value.lineno) else: lineno = 'unknown' textline = '' @@ -922,7 +921,7 @@ class VerboseTB(TBTools): # E.g. https://github.com/ipython/ipython/issues/9486 return '%s %s\n' % (link, call) - def linereader(file=file, lnum=[lnum], getline=ulinecache.getline): + def linereader(file=file, lnum=[lnum], getline=linecache.getline): line = getline(file, lnum[0]) lnum[0] += 1 return line @@ -1413,7 +1412,7 @@ class SyntaxTB(ListTB): and isinstance(value.filename, str) \ and isinstance(value.lineno, int): linecache.checkcache(value.filename) - newtext = ulinecache.getline(value.filename, value.lineno) + newtext = linecache.getline(value.filename, value.lineno) if newtext: value.text = newtext self.last_syntax_error = value