MCPcopy Index your code
hub / github.com/python/cpython / effective

Function effective

Lib/bdb.py:1115–1163  ·  view source on GitHub ↗

Return (active breakpoint, delete temporary flag) or (None, None) as breakpoint to act upon. The "active breakpoint" is the first entry in bplist[line, file] (which must exist) that is enabled, for which checkfuncname is True, and that has neither a False condition nor a

(file, line, frame)

Source from the content-addressed store, hash-verified

1113
1114
1115def effective(file, line, frame):
1116 """Return (active breakpoint, delete temporary flag) or (None, None) as
1117 breakpoint to act upon.
1118
1119 The "active breakpoint" is the first entry in bplist[line, file] (which
1120 must exist) that is enabled, for which checkfuncname is True, and that
1121 has neither a False condition nor a positive ignore count. The flag,
1122 meaning that a temporary breakpoint should be deleted, is False only
1123 when the condiion cannot be evaluated (in which case, ignore count is
1124 ignored).
1125
1126 If no such entry exists, then (None, None) is returned.
1127 """
1128 possibles = Breakpoint.bplist[file, line]
1129 for b in possibles:
1130 if not b.enabled:
1131 continue
1132 if not checkfuncname(b, frame):
1133 continue
1134 # Count every hit when bp is enabled
1135 b.hits += 1
1136 if not b.cond:
1137 # If unconditional, and ignoring go on to next, else break
1138 if b.ignore > 0:
1139 b.ignore -= 1
1140 continue
1141 else:
1142 # breakpoint and marker that it's ok to delete if temporary
1143 return (b, True)
1144 else:
1145 # Conditional bp.
1146 # Ignore count applies only to those bpt hits where the
1147 # condition evaluates to true.
1148 try:
1149 val = eval(b.cond, frame.f_globals, frame.f_locals)
1150 if val:
1151 if b.ignore > 0:
1152 b.ignore -= 1
1153 # continue
1154 else:
1155 return (b, True)
1156 # else:
1157 # continue
1158 except:
1159 # if eval fails, most conservative thing is to stop on
1160 # breakpoint regardless of ignore count. Don't delete
1161 # temporary, as another hint to user.
1162 return (b, False)
1163 return (None, None)
1164
1165
1166# -------------------- testing --------------------

Callers 1

break_hereMethod · 0.85

Calls 1

checkfuncnameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…