Skip to content

Commit d27e287

Browse files
Don't require 'exit' to be called with parentheses.
1 parent 5a840c0 commit d27e287

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ptpython/repl.py

+5
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ def run_and_show_expression(self, expression: str) -> None:
104104
except BaseException as e:
105105
self._handle_exception(e)
106106
else:
107+
if isinstance(result, exit):
108+
# When `exit` is evaluated without parentheses.
109+
# Automatically trigger the `ReplExit` exception.
110+
raise ReplExit
111+
107112
# Print.
108113
if result is not None:
109114
self._show_result(result)

0 commit comments

Comments
 (0)