[3.7] bpo-35931: Gracefully handle SyntaxError in pdb debug command (GH-11782) by miss-islington · Pull Request #11886 · python/cpython

@blueyed @miss-islington

…GH-11782)

Previously, `debug print(` would cause the interpreter to exit on a SyntaxError whereas `print(` would properly display the error and return to the pdb prompt.

This patch fixes this by pre-compiling the code before passing it to `Pdb.run`.

https://bugs.python.org/issue35931
(cherry picked from commit 4327705)

Co-authored-by: Daniel Hahler <github@thequod.de>