From f8e0bd12c5fefa3efe9ac59e6abac85bc3310ced Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sat, 25 May 2024 13:13:27 -0700 Subject: [PATCH 1/2] Add switching frame test for pdb --- Lib/test/test_pdb.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 1b329b205d2d0f..9fa65f5b989324 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -2555,7 +2555,7 @@ def test_pdb_issue_gh_94215(): def test_pdb_issue_gh_101673(): """See GH-101673 - Make sure ll won't revert local variable assignment + Make sure ll and switching frames won't revert local variable assignment >>> def test_function(): ... a = 1 @@ -2565,6 +2565,9 @@ def test_pdb_issue_gh_101673(): ... '!a = 2', ... 'll', ... 'p a', + ... 'u', + ... 'd', + ... 'p a', ... 'continue' ... ]): ... test_function() @@ -2577,6 +2580,14 @@ def test_pdb_issue_gh_101673(): 3 -> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() (Pdb) p a 2 + (Pdb) u + > (10)() + -> test_function() + (Pdb) d + > (3)test_function() + -> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + (Pdb) p a + 2 (Pdb) continue """ From 69ac1342b59b9d8e66618ce2f02330f2d1a06477 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sun, 26 May 2024 09:44:38 -0700 Subject: [PATCH 2/2] Add local variable check after up --- Lib/test/test_pdb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 9fa65f5b989324..cf69bc415c9b69 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -2566,6 +2566,7 @@ def test_pdb_issue_gh_101673(): ... 'll', ... 'p a', ... 'u', + ... 'p a', ... 'd', ... 'p a', ... 'continue' @@ -2581,8 +2582,10 @@ def test_pdb_issue_gh_101673(): (Pdb) p a 2 (Pdb) u - > (10)() + > (11)() -> test_function() + (Pdb) p a + *** NameError: name 'a' is not defined (Pdb) d > (3)test_function() -> import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()