GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support navigating exceptions chains in pdb · Issue #12707 · pytest-dev/pytest

Support navigating exceptions chains in pdb #12707

New issue
Copy link
New issue
Copy link
Closed
#12708
Closed
Support navigating exceptions chains in pdb#12707
#12708
Copy link
Labels
plugin: debuggingrelated to the debugging builtin plugintype: enhancementnew feature or API change, should be merged into features branch

Description

@AWhetter
AWhetter
opened on Aug 10, 2024
Issue body actions

What's the problem this feature will solve?

If running pytest with --pdb and a chain of exceptions is raised, you can only navigate the bottom exception in the chain. You cannot hop between exceptions in the chain

Describe the solution you'd like

Python 3.13.0a1 added support for jumping between chained exception in Pdb (python/cpython@f75cefd). pdb.post_mortem and pdb.Pdb.interaction must be passed an exception object for this to work. These functions used to accept only a traceback, so that's what pytest is passing currently. If pytest passes an exception instead then exception chains can be navigated. As a proof of concept:

diff --git a/src/_pytest/debugging.py b/src/_pytest/debugging.py
index 3e1463fff..578150f43 100644
--- a/src/_pytest/debugging.py
+++ b/src/_pytest/debugging.py
@@ -354,7 +354,7 @@ def _enter_pdb(
     tw.sep(">", "traceback")
     rep.toterminal(tw)
     tw.sep(">", "entering PDB")
-    tb = _postmortem_traceback(excinfo)
+    tb = excinfo.value #_postmortem_traceback(excinfo)
     rep._pdbshown = True  # type: ignore[attr-defined]
     post_mortem(tb)
     return rep

Alternative Solutions

I have not looked for alternate solutions.

Additional context

  • CPython github issue for supporting jumping between chained exception in Pdb: Support to jump between chained exception in Pdb python/cpython#106670
Reacted by Steinthor Palsson

Activity

  1. AWhetter
    added 2 commits that reference this issue on Aug 10, 2024

    Exception chains can be navigated when dropped into Pdb in Python 3.13+.

    This issue will close once commit c9866c8 is merged into the 'main' branch.
    c9866c8

    Exception chains can be navigated when dropped into Pdb in Python 3.13+.

    This issue will close once commit 3844b41 is merged into the 'main' branch.
    3844b41
  2. AWhetter
    added a commit that references this issue on Aug 22, 2024

    Exception chains can be navigated when dropped into Pdb in Python 3.13+

    This issue will close once commit 7d85123 is merged into the 'main' branch.
    7d85123
  3. Zac-HD
    added
    type: enhancementnew feature or API change, should be merged into features branch
    plugin: debuggingrelated to the debugging builtin plugin
    on Aug 23, 2024
  4. nicoddemus
    closed this as completedin #12708on Sep 7, 2024
  5. nicoddemus
    added a commit that references this issue on Sep 7, 2024

    Exception chains can be navigated when dropped into Pdb in Python 3.1…

    This issue will close once commit 3cc88d9 is merged into the 'main' branch.
    3cc88d9
  6. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

    4b75154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: debuggingrelated to the debugging builtin plugintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.