Skip to content

Commit

Permalink
Don't require 'exit' to be called with parentheses.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanslenders committed Jul 22, 2024
1 parent 5a840c0 commit d27e287
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ptpython/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d27e287

Please sign in to comment.