From 53da909474dd9a00a009abd49fb2f8cdcdb20774 Mon Sep 17 00:00:00 2001 From: andrey1931 Date: Tue, 21 Nov 2023 11:11:15 +0300 Subject: fix: ipdb не показывал исходный код PEERDIR'ов по команде list в py3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: ipdb не показывал следующую к исполнению команду в py2 и py3 ПР решает проблему https://st.yandex-team.ru/из п. 10: "не показывает текущее место в коде, на котором остановилось исполнение" Подсмотрел решение в pdb https://a.yandex-team.ru/arcadia/contrib/tools/python3/src/Lib/bdb.py?rev=rXXXXXX#L574 --- contrib/python/ipython/py2/IPython/core/debugger.py | 2 +- contrib/python/ipython/py3/IPython/core/debugger.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/python') diff --git a/contrib/python/ipython/py2/IPython/core/debugger.py b/contrib/python/ipython/py2/IPython/core/debugger.py index f08cfb1a789..6a41b8b404b 100644 --- a/contrib/python/ipython/py2/IPython/core/debugger.py +++ b/contrib/python/ipython/py2/IPython/core/debugger.py @@ -408,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 = ulinecache.getlines(filename, self.curframe.f_globals) start = min(start, len(lines) - context) start = max(start, 0) lines = lines[start : start + context] diff --git a/contrib/python/ipython/py3/IPython/core/debugger.py b/contrib/python/ipython/py3/IPython/core/debugger.py index 8e968548f81..26bd45ff948 100644 --- a/contrib/python/ipython/py3/IPython/core/debugger.py +++ b/contrib/python/ipython/py3/IPython/core/debugger.py @@ -616,7 +616,7 @@ class Pdb(OldPdb): ret.append("%s(%s)%s\n" % (link, lineno, call)) start = lineno - 1 - context//2 - lines = linecache.getlines(filename) + lines = linecache.getlines(filename, self.curframe.f_globals) start = min(start, len(lines) - context) start = max(start, 0) lines = lines[start : start + context] @@ -674,7 +674,7 @@ class Pdb(OldPdb): filename = self._exec_filename for lineno in range(first, last+1): - line = linecache.getline(filename, lineno) + line = linecache.getline(filename, lineno, self.curframe.f_globals) if not line: break -- cgit v1.3