File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3567,6 +3567,7 @@ def test_find_function_empty_file(self):
35673567 def test_find_function_found (self ):
35683568 self ._assert_find_function (
35693569 """\
3570+
35703571def foo():
35713572 pass
35723573
@@ -3580,6 +3581,20 @@ def quux():
35803581 ('bœr' , 5 ),
35813582 )
35823583
3584+ def test_print_stack_entry_uses_dynamic_line_prefix (self ):
3585+ """Test that pdb.line_prefix binding is dynamic (gh-141781)."""
3586+ stdout = io .StringIO ()
3587+ p = pdb .Pdb (stdout = stdout )
3588+
3589+ # Get the current frame to use for printing
3590+ frame = sys ._getframe ()
3591+
3592+ with support .swap_attr (pdb , 'line_prefix' , 'CUSTOM_PREFIX> ' ):
3593+ p .print_stack_entry ((frame , frame .f_lineno ))
3594+
3595+ # Check if the custom prefix appeared in the output
3596+ self .assertIn ('CUSTOM_PREFIX> ' , stdout .getvalue ())
3597+
35833598 def test_find_function_found_with_encoding_cookie (self ):
35843599 self ._assert_find_function (
35853600 """\
You can’t perform that action at this time.
0 commit comments