-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-121468: Support async breakpoint in pdb #132576
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-121468: Support async breakpoint in pdb #132576
Conversation
Hi @iritkatriel , do you think this needs to be reviewed by asyncio expert? |
Yes, ideally. |
@kumaraditya303 I hope I can have this in 3.14 because it's a demanding feature. Could you take a look at it and see if it's a reasonable approach? Thanks! |
Lib/pdb.py
Outdated
and e.msg == "'await' outside function" | ||
): | ||
try: | ||
self._exec_await(buffer, globals, locals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be run without the exception from line 891 in the context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I restructured the code as we know whether it is an await code during compile. The nice side effect is that we don't need to execute the code under the exception context.
How about adding these direct links to what you added in the docs |
What do you mean? The link is already in whatsnew entry. |
@iritkatriel do you have any other concerns about this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Hi @iritkatriel , if you don't have any objections I'll merge this in a day or so :) |
Go for it. @kumaraditya303 has approved. |
I finally figured out how to support
await
in pdb without too much hack - we can make the breakpoint itself an awaitable, and everything is simply integrated into the system!This PR introduced a new function
pdb.set_trace_async
which the users shouldawait
, and with that function, the users can do theirawait
s in th debugger!📚 Documentation preview 📚: https://cpython-previews--132576.org.readthedocs.build/