Skip to content

Commit 0c0f4fd

Browse files
committed
Move the _executable_linenos_cache to Bdb instance
1 parent 026f62a commit 0c0f4fd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/bdb.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ def _get_executable_linenos(code):
189189
return linenos
190190

191191

192-
_executable_linenos_cache = {}
193-
194192

195193
class Bdb:
196194
"""Generic Python debugger base class.
@@ -210,6 +208,7 @@ def __init__(self, skip=None, backend='settrace'):
210208
self.skip = set(skip) if skip else None
211209
self.breaks = {}
212210
self.fncache = {}
211+
self._executable_linenos_cache = {}
213212
self.frame_trace_lines_opcodes = {}
214213
self.frame_returning = None
215214
self.trace_opcodes = False
@@ -686,13 +685,13 @@ def set_break(self, filename, lineno, temporary=False, cond=None,
686685
line = linecache.getline(filename, lineno)
687686
if not line:
688687
return 'Line %s:%d does not exist' % (filename, lineno)
689-
if filename not in _executable_linenos_cache:
688+
if filename not in self._executable_linenos_cache:
690689
source = ''.join(linecache.getlines(filename))
691690
if source:
692691
with suppress(SyntaxError):
693692
code = compile(source, filename, 'exec')
694-
_executable_linenos_cache[filename] = _get_executable_linenos(code)
695-
executable_lines = _executable_linenos_cache.get(filename)
693+
self._executable_linenos_cache[filename] = _get_executable_linenos(code)
694+
executable_lines = self._executable_linenos_cache.get(filename)
696695
if executable_lines and lineno not in executable_lines:
697696
return 'Line %d has no code associated with it' % lineno
698697
self._add_to_breaks(filename, lineno)

0 commit comments

Comments
 (0)