Skip to content

Commit 23e15c8

Browse files
Fixed Control-C key binding for ptipython.
1 parent 0b97478 commit 23e15c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ptpython/ipython.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ def get_globals():
217217
self.python_input = python_input
218218

219219
def prompt_for_code(self):
220-
return self.python_input.app.run()
220+
try:
221+
return self.python_input.app.run()
222+
except KeyboardInterrupt:
223+
self.python_input.default_buffer.document = Document()
224+
return ''
221225

222226

223227
def initialize_extensions(shell, extensions):

0 commit comments

Comments
 (0)