Skip to content

bpo-36335: add bdb.Bdb.is_skipped_frame #12392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Lib/bdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,25 @@ def dispatch_exception(self, frame, arg):
# methods, but they may if they want to redefine the
# definition of stopping and breakpoints.

def is_skipped_frame(self, frame):
"Return True if the given frame should be skipped."
if self.skip:
return self.is_skipped_module(frame.f_globals.get('__name__'))
return False

def is_skipped_module(self, module_name):
"Return True if module_name matches any skip pattern."
if module_name is None: # some modules do not have names
return False
for pattern in self.skip:
if fnmatch.fnmatch(module_name, pattern):
return True
if module_name: # some modules do not have names
for pattern in self.skip:
if fnmatch.fnmatch(module_name, pattern):
return True
return False

def stop_here(self, frame):
"Return True if frame is below the starting frame in the stack."
# (CT) stopframe may now also be None, see dispatch_call.
# (CT) the former test for None is therefore removed from here.
if self.skip and \
self.is_skipped_module(frame.f_globals.get('__name__')):
if self.is_skipped_frame(frame):
return False
if frame is self.stopframe:
if self.stoplineno == -1:
Expand Down