Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Polish comments
  • Loading branch information
gaogaotiantian committed Mar 21, 2023
commit 3d85f0a3b52712e853cc17683fc5a584c4e33220
3 changes: 3 additions & 0 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,9 @@ def format_stack_entry(self, frame, lineno, f_locals, lprefix=': '):
or '<lambda>', the input arguments, the return value, and the
line of code (if it exists).

This function is overwritten because accessing frame.f_locals will
refresh the dictionary. We need to provide cached f_locals to avoid
reverting local variable changes to it
"""
import linecache, reprlib
filename = self.canonic(frame.f_code.co_filename)
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,9 +1475,9 @@ def test_pdb_issue_gh_94215():
"""

def test_pdb_issue_gh_101673():
"""See GH-101673
"""See GH-101673 and GH-102864

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
Expand Down