Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-83151: Make closure work on pdb#111094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
brandtbucher merged 13 commits intopython:mainfromgaogaotiantian:pdb-closure
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
720a584
Make closure work on pdb
gaogaotiantianOct 20, 2023
8232457
Always update local variables
gaogaotiantianOct 20, 2023
8df6d2b
📜🤖 Added by blurb_it.
blurb-it[bot]Oct 20, 2023
9c68aef
Merge branch 'main' into pdb-closure
gaogaotiantianMay 4, 2024
fe5a6f6
Update the code for pep 667
gaogaotiantianMay 5, 2024
cc21873
Remove blank line
gaogaotiantianMay 5, 2024
d37b5a7
Merge branch 'main' into pdb-closure
gaogaotiantianMay 5, 2024
cd46a05
Update 2023-10-20-03-50-17.gh-issue-83151.bcsD40.rst
gaogaotiantianMay 5, 2024
d04bc5d
Merge branch 'main' into pdb-closure
gaogaotiantianMay 5, 2024
aa91238
Fix test for breakpoint change
gaogaotiantianMay 5, 2024
7650aa9
Apply suggestions from code review
gaogaotiantianMay 6, 2024
3c44f88
Fix some typos in review and add exception check
gaogaotiantianMay 6, 2024
18e7a16
Apply suggestions from code review
gaogaotiantianMay 6, 2024
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
PrevPrevious commit
NextNext commit
Always update local variables
  • Loading branch information
@gaogaotiantian
gaogaotiantian committedOct 20, 2023
commit8232457a7c6fcccb2da482d65e99f7697877ac93
5 changes: 4 additions & 1 deletionLib/pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -562,7 +562,10 @@ def _exec_in_closure(self, source, globals, locals):

# Add write-back to update the locals
locals["__pdb_write_back__"] = {}
source += """\nfor key, val in locals().items():\n __pdb_write_back__[key] = val"""
source = ("try:\n" +
textwrap.indent(source, " ") + "\n" +
"finally:\n" +
" for key, val in locals().items():\n __pdb_write_back__[key] = val")

try:
local_vars = list(locals.keys())
Expand Down
8 changes: 7 additions & 1 deletionLib/test/test_pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2049,6 +2049,8 @@ def test_pdb_closure():
... 'lst = [n for n in range(10) if (n % x) == 0]',
... 'lst',
... 'sum(n for n in lst if n > x)',
... 'x = 1; raise Exception()',
... 'x',
... 'def f():',
... ' return x',
... '',
Expand All@@ -2075,11 +2077,15 @@ def test_pdb_closure():
[0, 2, 4, 6, 8]
(Pdb) sum(n for n in lst if n > x)
18
(Pdb) x = 1; raise Exception()
*** Exception
(Pdb) x
1
(Pdb) def f():
... return x
...
(Pdb) f()
2
1
(Pdb) c
"""

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp