Skip to content

Commit a00a387

Browse files
committed
Update bdb.py from CPython v3.12.0
1 parent b4ee044 commit a00a387

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Lib/bdb.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,12 @@ def format_stack_entry(self, frame_lineno, lprefix=': '):
570570
rv = frame.f_locals['__return__']
571571
s += '->'
572572
s += reprlib.repr(rv)
573-
line = linecache.getline(filename, lineno, frame.f_globals)
574-
if line:
575-
s += lprefix + line.strip()
573+
if lineno is not None:
574+
line = linecache.getline(filename, lineno, frame.f_globals)
575+
if line:
576+
s += lprefix + line.strip()
577+
else:
578+
s += f'{lprefix}Warning: lineno is None'
576579
return s
577580

578581
# The following methods can be called by clients to use
@@ -805,15 +808,18 @@ def checkfuncname(b, frame):
805808
return True
806809

807810

808-
# Determines if there is an effective (active) breakpoint at this
809-
# line of code. Returns breakpoint number or 0 if none
810811
def effective(file, line, frame):
811-
"""Determine which breakpoint for this file:line is to be acted upon.
812+
"""Return (active breakpoint, delete temporary flag) or (None, None) as
813+
breakpoint to act upon.
814+
815+
The "active breakpoint" is the first entry in bplist[line, file] (which
816+
must exist) that is enabled, for which checkfuncname is True, and that
817+
has neither a False condition nor a positive ignore count. The flag,
818+
meaning that a temporary breakpoint should be deleted, is False only
819+
when the condiion cannot be evaluated (in which case, ignore count is
820+
ignored).
812821
813-
Called only if we know there is a breakpoint at this location. Return
814-
the breakpoint that was triggered and a boolean that indicates if it is
815-
ok to delete a temporary breakpoint. Return (None, None) if there is no
816-
matching breakpoint.
822+
If no such entry exists, then (None, None) is returned.
817823
"""
818824
possibles = Breakpoint.bplist[file, line]
819825
for b in possibles:

0 commit comments

Comments
 (0)