-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-141982: Fix pdb can't set breakpoints on async functions #141983
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
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Misc/NEWS.d/next/Library/2025-11-26-15-36-55.gh-issue-141982.-8yHA3.rst
Outdated
Show resolved
Hide resolved
|
I'm not familiar with the For now, however, I think it's acceptable to just handle the async function case described in the original issue because this is the most common situation. |
gaogaotiantian
left a comment
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.
Let's optimize the test case a bit. So we want a test case that is accurate and comprehensive, while being concise. The sleep and World part did not do anything - we don't need them.
Checking Hello is not the best practice because there could be many ways that Hello appears in stdout - it's part of the source code and you are printing it. Say the breakpoint is never set, you'd still have Hello in stdout.
One way is to check World is not printed out - which could be an indicator that a breakpoint is set. For Hello I think we need to check it in a better way.
2dfc822 to
660df89
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Thanks for review, @gaogaotiantian ! Do you think the current tests are sufficient? |
|
Thank you for fixing this. |
Skip coroutine tests if SKIP_CORO_TESTS is True.
…thon#141983) Co-authored-by: Tian Gao <[email protected]>
Fix: #141982
I found that while debugging with pdb you currently cannot set a breakpoint on an async function. Reproducer:
If you run pdb and try to set a breakpoint on main you get:
This happens because the regular expression used by find_function does not match async functions:
cpython/Lib/pdb.py
Lines 132 to 133 in 2ff8608
After the fix:
Now we can set breakpoints on async functions as expected.
pdbbreakpoints onasyncfunctions #141982