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-57537: Support breakpoints for zipimport modules on pdb#130290

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

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantiangaogaotiantian commentedFeb 19, 2025
edited by bedevere-appbot
Loading

Currently when pdb sets a breakpoint on a known function, it uses the filename of the code object of that specific function to locate the source. However, this does not work for zipimport modules, because themodule_globals passed in is of the current frame, andlinecache needs that to get the source.

The correct way to deal with this is to pass in themodule_globals of the function itself, not of the current frame. This not only solves the problem for zipimport, but also fixes other potential issues when the module of the function has its own loader.

'p x + x',
'q'
]))
self.assertIn('82',stdout)
Copy link
Member

Choose a reason for hiding this comment

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

What is '82'?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's the result ofp x + x, I want to confirm that we did stop insidefoo.bar. I can maybe change the testing code to use string so it's more obvious? Or I can add a comment here. The other possibility is to use a more advanced command to rule out the false positives (for example, you can't simply checkbar because it will be shown anyway).

Copy link
Member

Choose a reason for hiding this comment

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

Yes, a string would be better.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I constructed a small piece of unique string and the assertion is close to the command - I think that made it clearer.

filename=None
lineno=None
cond=None
module_globals=None
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably call this func_globals. Up to you.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I was trying to match the name forlinecache. It is a module globals acquired from a function, and the part matters is about the module (loader and stuff).

@gaogaotiantiangaogaotiantian merged commitee337be intopython:mainFeb 20, 2025
43 checks passed
@gaogaotiantiangaogaotiantian deleted the pdb-zipimport-break branchFebruary 20, 2025 02:01
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@iritkatrieliritkatrieliritkatriel approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@gaogaotiantian@iritkatriel

[8]ページ先頭

©2009-2025 Movatter.jp