Skip to content

Commit dd0c393

Browse files
committed
Update test_bdb.py from CPython v3.12.0
1 parent a00a387 commit dd0c393

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Lib/test/test_bdb.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from itertools import islice, repeat
6060
from test.support import import_helper
6161
from test.support import os_helper
62+
from test.support import patch_list
6263

6364

6465
class BdbException(Exception): pass
@@ -432,8 +433,9 @@ def __exit__(self, type_=None, value=None, traceback=None):
432433
not_empty = ''
433434
if self.tracer.set_list:
434435
not_empty += 'All paired tuples have not been processed, '
435-
not_empty += ('the last one was number %d' %
436+
not_empty += ('the last one was number %d\n' %
436437
self.tracer.expect_set_no)
438+
not_empty += repr(self.tracer.set_list)
437439

438440
# Make a BdbNotExpectedError a unittest failure.
439441
if type_ is not None and issubclass(BdbNotExpectedError, type_):
@@ -728,6 +730,14 @@ def test_until_in_caller_frame(self):
728730
def test_skip(self):
729731
# Check that tracing is skipped over the import statement in
730732
# 'tfunc_import()'.
733+
734+
# Remove all but the standard importers.
735+
sys.meta_path[:] = (
736+
item
737+
for item in sys.meta_path
738+
if item.__module__.startswith('_frozen_importlib')
739+
)
740+
731741
code = """
732742
def main():
733743
lno = 3
@@ -1224,5 +1234,12 @@ def main():
12241234
tracer.runcall(tfunc_import)
12251235

12261236

1237+
class TestRegressions(unittest.TestCase):
1238+
def test_format_stack_entry_no_lineno(self):
1239+
# See gh-101517
1240+
self.assertIn('Warning: lineno is None',
1241+
Bdb().format_stack_entry((sys._getframe(), None)))
1242+
1243+
12271244
if __name__ == "__main__":
12281245
unittest.main()

0 commit comments

Comments
 (0)