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-101673: Fix pdb bug that local variable changes lost after longlist#101674

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
iritkatriel merged 7 commits intopython:mainfromgaogaotiantian:fix-issue-101673
Mar 12, 2023

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantiangaogaotiantian commentedFeb 8, 2023
edited by bedevere-bot
Loading

The bug is described in#101673.

Usingf_code.co_name to check whether it's a frame module avoids readingf_local whose side effect reverts local variable changes in pdb.

arhadthedev, artemmukhin, ProgramRipper, jingxu94, sledgeh4w, tanloong, GGG-HHH, zhangwang997, shengbo-ma, kelerensheng, and 3 more reacted with thumbs up emoji
@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@ghost
Copy link

ghost commentedFeb 8, 2023
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@arhadthedevarhadthedev added the stdlibPython modules in the Lib dir labelFeb 8, 2023
@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@artemmukhin
Copy link
Contributor

@iritkatriel I am wondering if you could be an appropriate reviewer for this. Could you please take a look?

@iritkatriel
Copy link
Member

Thanks for adding the test. Before merging this I would need to spend some time to understand why this happened and to convince myself that this is the right solution. If someone else reviews it before I get around to it that's obviously fine.

@artemmukhin
Copy link
Contributor

@iritkatriel Thank you for your quick response.

I have investigated the issue further and discovered that the problematicobj.f_globals is obj.f_locals check was introduced in5ed2b5a to work around the limitation ofinspect.getsourcelines, as the latter did not check that the given frame is a module-level frame.

However,inspect.getsourcelines was independently corrected in91cb298 using the sameobject.f_code.co_name == "<module>" technique.

So I believe that we should consider replacing the custompdb.getsourcelines function with directinspect.getsourcelines invocations. After making this change, the updatedtest_pdb still passes.@gaogaotiantian WDYT?

@gaogaotiantian
Copy link
MemberAuthor

Yeah I think that’s the way to go. The original customized pdb version was to avoid module level frame issue and it would be nice to not to keep multiple identical code pieces around. The functionality seems to be the same. I’ll make the changes to use inspect version directly and remove the pdb version.

artemmukhin reacted with thumbs up emoji

@gaogaotiantian
Copy link
MemberAuthor

As@ortem said, the reason we had a separategetsourcelines in pdb was because theinspect version did not deal with the module level frame. It does now so we can just switch back toinspect version and kept one less duplicated code piece. I did include the regression test for the issue.

Copy link
Member

@iritkatrieliritkatriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Makes sense. Thank you!

@iritkatrieliritkatriel added 3.11only security fixes 3.12only security fixes needs backport to 3.11only security fixes type-bugAn unexpected behavior, bug, or error needs backport to 3.10only security fixes and removed 3.11only security fixes 3.12only security fixes labelsMar 12, 2023
@iritkatrieliritkatriel merged commit5d677c5 intopython:mainMar 12, 2023
@miss-islington
Copy link
Contributor

Thanks@gaogaotiantian for the PR, and@iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry,@gaogaotiantian and@iritkatriel, I could not cleanly backport this to3.10 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 5d677c556f03a34d1c2d86e4cc96025870c20c12 3.10

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 12, 2023
…ter longlist (pythonGH-101674)(cherry picked from commit5d677c5)Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
@bedevere-bot
Copy link

GH-102632 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelMar 12, 2023
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull requestMar 12, 2023
miss-islington added a commit that referenced this pull requestMar 12, 2023
…nglist (GH-101674)(cherry picked from commit5d677c5)Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
@bedevere-bot
Copy link

GH-102633 is a backport of this pull request to the3.10 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.10only security fixes labelMar 12, 2023
pablogsal pushed a commit that referenced this pull requestMar 13, 2023
…fter longlist (#101674) (#102633)GH-101673: Fix pdb bug where local variable changes are lost after longlist (#101674)(cherry picked from commit5d677c5)Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
@gaogaotiantiangaogaotiantian deleted the fix-issue-101673 branchMarch 23, 2023 23:29
warsaw pushed a commit to warsaw/cpython that referenced this pull requestApr 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@iritkatrieliritkatrieliritkatriel approved these changes

Assignees

@iritkatrieliritkatriel

Labels
stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@gaogaotiantian@bedevere-bot@artemmukhin@iritkatriel@miss-islington@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp