|
59 | 59 | from itertools import islice, repeat |
60 | 60 | from test.support import import_helper |
61 | 61 | from test.support import os_helper |
| 62 | +from test.support import patch_list |
62 | 63 |
|
63 | 64 |
|
64 | 65 | class BdbException(Exception): pass |
@@ -432,8 +433,9 @@ def __exit__(self, type_=None, value=None, traceback=None): |
432 | 433 | not_empty = '' |
433 | 434 | if self.tracer.set_list: |
434 | 435 | 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' % |
436 | 437 | self.tracer.expect_set_no) |
| 438 | + not_empty += repr(self.tracer.set_list) |
437 | 439 |
|
438 | 440 | # Make a BdbNotExpectedError a unittest failure. |
439 | 441 | if type_ is not None and issubclass(BdbNotExpectedError, type_): |
@@ -728,6 +730,14 @@ def test_until_in_caller_frame(self): |
728 | 730 | def test_skip(self): |
729 | 731 | # Check that tracing is skipped over the import statement in |
730 | 732 | # '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 | + |
731 | 741 | code = """ |
732 | 742 | def main(): |
733 | 743 | lno = 3 |
@@ -1224,5 +1234,12 @@ def main(): |
1224 | 1234 | tracer.runcall(tfunc_import) |
1225 | 1235 |
|
1226 | 1236 |
|
| 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 | + |
1227 | 1244 | if __name__ == "__main__": |
1228 | 1245 | unittest.main() |
0 commit comments