# 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

<!-- gh-linked-prs -->
### Linked PRs
* gh-119882
* gh-120533
* gh-120594
* gh-120919
* gh-120928
<!-- /gh-linked-prs -->

Python 3.13.0b1: suboptimal `pdb._post_mortem` behavior if `.pdbrc` exists
This is a GitHub Issue
repo:cpython
owner:python
Title : Python 3.13.0b1: suboptimal `pdb._post_mortem` behavior if `.pdbrc` exists
Issue date:

--- start body ---
# 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

<!-- gh-linked-prs -->
### Linked PRs
* gh-119882
* gh-120533
* gh-120594
* gh-120919
* gh-120928
<!-- /gh-linked-prs -->

--- end body ---
