Skip to content

Python 3.13.0b1: suboptimal pdb._post_mortem behavior if .pdbrc exists #119824

Closed
@d-maurer

Description

@d-maurer

Bug report

Bug description:

pdb.post_mortem used to display the current stack entry before the command loop (which has been useful). With Python 3.13, this is no longer the case when there is a .pdbrc file.
The reason is the following code in pdb.Pdb.interaction:

            # if we have more commands to process, do not show the stack entry
            if not self.cmdqueue:
                self.print_stack_entry(self.stack[self.curindex])

If a .pdbrc exists, self.cmdqueue contains the commands from this file and the current stack entry is not displayed.

I suggest the introduction of a new interaction parameter show_stack_entry (with default False) and to display the current stack entry if it has a true value. Set it to True in the _post_mortem call of interaction.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions