Ignore bdb.BdbQuit when handling exceptions

`bdb.BdbQuit` is used when quitting the debugger.
It should not a) cause the debugger to be started (with `-P` / `--pdb`),
and b) not a "crash" to be logged.

This helps when using `pdb.set_trace()` manually, and quitting it with
`q`.

It gets used in `build_main`, and `BuildDoc.run` (distutils command).
This commit is contained in:
Daniel Hahler 2020-03-10 10:48:35 +01:00
parent 46b4f595ca
commit 5955ad47e4

View File

@ -29,6 +29,11 @@ from sphinx.util.docutils import docutils_namespace, patch_docutils
def handle_exception(app: Sphinx, args: Any, exception: BaseException, stderr: IO = sys.stderr) -> None: # NOQA
import bdb
if isinstance(exception, bdb.BdbQuit):
return
if args.pdb:
import pdb
print(red(__('Exception occurred while building, starting debugger:')),