python / python/cpython

Make pdb asyncio aware

Ouverte
#121,468 13 commentaires 14 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

stdlib topic-asyncio type-feature
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

Feature or enhancement

Proposal:

Currently pdb does not know anything about asyncio, even though it's a feature officially supported for a long time. I will add supports for asyncio in roughly 3 steps (does not have to be exact 3 PRs):

  1. pdb will generate some passive info for asyncio. If the user hits a breakpoint inside an asyncio task, there will be a one line message with the current stack indicating which task the user is in. A convenience variable $_asynctask will be added to refer to the current task.
  2. pdb will provide a way for the user to examine all the tasks in the current event loop with a new command. The user can inspect how many tasks are there and their status. Maybe they can even check the frames for each task.
  3. pdb will enable users to switch between tasks, aka letting users to specify "run until I'm in this task". pdb will also possibly provide a way for the users to cancel the task.

In theory, many of the features are already possible with manual code as pdb can execute arbitrary code anyway. However, I believe it's helpful for the users to have a more convenient way to debug their async programs.

This was briefly mentioned in the language summit at PyCon this year, no one objected (maybe because they have other stuff that they were more against :) ).

This should not impact any user experience with the existing code that not involves asyncio.

If you have any other suggestions or objections, please let me know.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-124367
  • gh-131258
  • gh-131388
  • gh-132576

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par examiner les points d’entrée existants de pdb ainsi que les API de asyncio relatives aux tâches et aux boucles d’événements. Comparez les trois domaines proposés —contexte des tâches, inspection des tâches et changement ou annulation des tâches— et identifiez une première modification de portée étroitement limitée, accompagnée de tests. Le travail terminé doit inclure un comportement convenu qui préserve l’utilisation existante de pdb hors asyncio.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
devtools
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.