FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-121468: Support async breakpoint in pdb by gaogaotiantian · Pull Request #132576 · python/cpython · GitHub

/ cpython Public

gh-121468: Support async breakpoint in pdb - #132576

Merged
gaogaotiantian merged 13 commits into
python:mainfrom
gaogaotiantian:support-async-breakpoint
Apr 29, 2025
Merged

gh-121468: Support async breakpoint in pdb#132576
gaogaotiantian merged 13 commits into
python:mainfrom
gaogaotiantian:support-async-breakpoint

Conversation

gaogaotiantian commented Apr 16, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

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 should await, and with that function, the users can do their awaits in th debugger!


📚 Documentation preview 📚: https://cpython-previews--132576.org.readthedocs.build/

gaogaotiantian marked this pull request as ready for review April 16, 2025 23:44

Copy link
Copy Markdown
Member Author

Hi @iritkatriel , do you think this needs to be reviewed by asyncio expert?

Copy link
Copy Markdown
Member

Yes, ideally.

Copy link
Copy Markdown
Member Author

@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!

Comment thread Lib/test/test_pdb.py
Comment thread Lib/pdb.py Outdated
Comment thread Lib/pdb.py Outdated
and e.msg == "'await' outside function"
):
try:
self._exec_await(buffer, globals, locals)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this should be run without the exception from line 891 in the context

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member Author

What do you mean? The link is already in whatsnew entry.

Comment thread Lib/test/test_pdb.py

Copy link
Copy Markdown
Member Author

@iritkatriel do you have any other concerns about this PR?

auvipy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

looks good

Copy link
Copy Markdown
Member Author

Hi @iritkatriel , if you don't have any objections I'll merge this in a day or so :)

Copy link
Copy Markdown
Member

Hi @iritkatriel , if you don't have any objections I'll merge this in a day or so :)

Go for it. @kumaraditya303 has approved.

gaogaotiantian merged commit caee16f into python:main Apr 29, 2025
gaogaotiantian deleted the support-async-breakpoint branch April 29, 2025 16:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL