New GitHub issue #118714 from chgnrdv:<br>
<hr>
<pre>
# Bug report
### Bug description:
In 3.12 and earlier, if user enters `quit`/`exit` commands or does Ctrl-D, `pdb` restarts script with corresponding message and exits only on repeated `quit`/`exit`/Ctrl-D:
```
$ python -m pdb -c c pdb_bug.py
Traceback (most recent call last):
File "/usr/local/lib/python3.11/pdb.py", line 1775, in main
pdb._run(target)
File "/usr/local/lib/python3.11/pdb.py", line 1643, in _run
self.run(target.code)
File "/usr/local/lib/python3.11/bdb.py", line 600, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/home/radislav/projects/cpython/pdb_bug.py", line 1, in <module>
raise ValueError()
ValueError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
Post mortem debugger finished. The /home/radislav/projects/cpython/pdb_bug.py will be restarted
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
$
```
Since fa18b0afe47615dbda15407a102b84e40cadf6a5 only message is printed, but Python exits completely:
```
$ ./python -m pdb -c c pdb_bug.py
Traceback (most recent call last):
...
File "/home/radislav/projects/cpython/pdb_bug.py", line 1, in <module>
raise ValueError()
ValueError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
Post mortem debugger finished. The /home/radislav/projects/cpython/pdb_bug.py will be restarted
$
```
@gaogaotiantian, what's your opinion? Should we restore the old behavior or remove confusing message about "restart"? As I can see, `pdb` docs doesn't state explicitly what `quit`/`exit` commands should do in post-mortem debugger.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/118714">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>