diff --git a/ptpython/repl.py b/ptpython/repl.py index b6fc0a5..6b60018 100644 --- a/ptpython/repl.py +++ b/ptpython/repl.py @@ -104,6 +104,11 @@ def run_and_show_expression(self, expression: str) -> None: except BaseException as e: self._handle_exception(e) else: + if isinstance(result, exit): + # When `exit` is evaluated without parentheses. + # Automatically trigger the `ReplExit` exception. + raise ReplExit + # Print. if result is not None: self._show_result(result)