-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: Show asyncio information in pdb #124367
base: main
Are you sure you want to change the base?
Conversation
@@ -79,6 +79,7 @@ | |||
import codeop | |||
import pprint | |||
import signal | |||
import asyncio |
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.
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.
asyncio will be used as long as pdb is used. pdb
is not an module that is often imported explicitly or implicitly, I don't think import time of pdb
is specifically critical.
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.
You're right. I didn't realize that at the time
@@ -596,6 +602,38 @@ def _hold_exceptions(self, exceptions): | |||
self._chained_exceptions = tuple() | |||
self._chained_exception_index = 0 | |||
|
|||
def _get_asyncio_loop_and_task(self): | |||
try: | |||
loop = asyncio.get_event_loop() |
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.
You can replace this with direct call to current_task and if it exists get loop from it, using get_event_loop can have unwanted consequences
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.
Yeah I will change this.
This is a draft because we still need to decide on the format.
I'm aiming for something short, the original
repr
of asyncio task is just too long. For now it's likeIf pdb stops in an asyncio task, it will print an extra line showing the name of the task (
Task-1
), the name of the coroutine (main
) and the status (pending
).As of now I think it will always be
pending
because we hit a breakpoint inside. However, we will add the feature to list all asyncio tasks in the future and allow switching between those, so we will have more status and it will be some important information.I will work on the docs and the tests as long as the format is okay.