diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-11-08 13:25:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-11-08 13:25:25 +0000 |
commit | 97570da1e433558f3fffec0f67b6d15a8d36bc05 (patch) | |
tree | 87e8000313403b30628f740be25126fd0c9ad219 /ptpython/repl.py | |
parent | Adding upstream version 3.0.19. (diff) | |
download | ptpython-97570da1e433558f3fffec0f67b6d15a8d36bc05.tar.xz ptpython-97570da1e433558f3fffec0f67b6d15a8d36bc05.zip |
Adding upstream version 3.0.20.upstream/3.0.20
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ptpython/repl.py')
-rw-r--r-- | ptpython/repl.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ptpython/repl.py b/ptpython/repl.py index 220c673..b55b5d5 100644 --- a/ptpython/repl.py +++ b/ptpython/repl.py @@ -135,6 +135,12 @@ class PythonRepl(PythonInput): text = self.read() except EOFError: return + except BaseException as e: + # Something went wrong while reading input. + # (E.g., a bug in the completer that propagates. Don't + # crash the REPL.) + traceback.print_exc() + continue # Run it; display the result (or errors if applicable). self.run_and_show_expression(text) @@ -192,6 +198,12 @@ class PythonRepl(PythonInput): text = await loop.run_in_executor(None, self.read) except EOFError: return + except BaseException: + # Something went wrong while reading input. + # (E.g., a bug in the completer that propagates. Don't + # crash the REPL.) + traceback.print_exc() + continue # Eval. await self.run_and_show_expression_async(text) @@ -333,6 +345,9 @@ class PythonRepl(PythonInput): # not used. try: import black + + if not hasattr(black, "Mode"): + raise ImportError except ImportError: pass # no Black package in your installation else: |