From c38a9a8651e56592aee168563ede586b4897c091 2020-06-30 20:52:44 From: Matthias Bussonnier Date: 2020-06-30 20:52:44 Subject: [PATCH] Merge pull request #12413 from Carreau/print_exc catch unrecoverable error --- diff --git a/IPython/terminal/ptutils.py b/IPython/terminal/ptutils.py index ed7ad45..3cf3c11 100644 --- a/IPython/terminal/ptutils.py +++ b/IPython/terminal/ptutils.py @@ -112,8 +112,11 @@ class IPythonPTCompleter(Completer): try: yield from self._get_completions(body, offset, cursor_position, self.ipy_completer) except Exception as e: - from traceback import print_tb - print_tb(e) + try: + exc_type, exc_value, exc_tb = sys.exc_info() + traceback.print_exception(exc_type, exc_value, exc_tb) + except AttributeError: + print('Unrecoverable Error in completions') @staticmethod def _get_completions(body, offset, cursor_position, ipyc):