Fix stepping into a frame without a __name__ (GH-12064)
This commit is contained in:
parent
839b925f63
commit
86900a4900
|
@ -190,6 +190,8 @@ class Bdb:
|
||||||
|
|
||||||
def is_skipped_module(self, module_name):
|
def is_skipped_module(self, module_name):
|
||||||
"Return True if module_name matches any skip pattern."
|
"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:
|
for pattern in self.skip:
|
||||||
if fnmatch.fnmatch(module_name, pattern):
|
if fnmatch.fnmatch(module_name, pattern):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -730,6 +730,13 @@ class StateTestCase(BaseTestCase):
|
||||||
with TracerRun(self, skip=skip) as tracer:
|
with TracerRun(self, skip=skip) as tracer:
|
||||||
tracer.runcall(tfunc_import)
|
tracer.runcall(tfunc_import)
|
||||||
|
|
||||||
|
def test_skip_with_no_name_module(self):
|
||||||
|
# some frames have `globals` with no `__name__`
|
||||||
|
# for instance the second frame in this traceback
|
||||||
|
# exec(compile('raise ValueError()', '', 'exec'), {})
|
||||||
|
bdb = Bdb(skip=['anything*'])
|
||||||
|
self.assertIs(bdb.is_skipped_module(None), False)
|
||||||
|
|
||||||
def test_down(self):
|
def test_down(self):
|
||||||
# Check that set_down() raises BdbError at the newest frame.
|
# Check that set_down() raises BdbError at the newest frame.
|
||||||
self.expect_set = [
|
self.expect_set = [
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix ``pdb`` with ``skip=...`` when stepping into a frame without a
|
||||||
|
``__name__`` global. Patch by Anthony Sottile.
|
Loading…
Reference in New Issue