Skip to content

gh-129628: Remove special handling of KeyBoardInterrupt exception #129636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions Lib/asyncio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ def runcode(self, code):
def callback():
global return_code
global repl_future
global keyboard_interrupted

repl_future = None
keyboard_interrupted = False

func = types.FunctionType(code, self.locals)
try:
Expand All @@ -45,7 +43,6 @@ def callback():
self.loop.stop()
return
except KeyboardInterrupt as ex:
keyboard_interrupted = True
future.set_exception(ex)
return
except BaseException as ex:
Expand All @@ -71,10 +68,7 @@ def callback():
self.loop.stop()
return
except BaseException:
if keyboard_interrupted:
self.write("\nKeyboardInterrupt\n")
else:
self.showtraceback()
self.showtraceback()


class REPLThread(threading.Thread):
Expand Down Expand Up @@ -160,7 +154,6 @@ def interrupt(self) -> None:
console = AsyncIOInteractiveConsole(repl_locals, loop)

repl_future = None
keyboard_interrupted = False

try:
import readline # NoQA
Expand Down Expand Up @@ -192,7 +185,6 @@ def interrupt(self) -> None:
try:
loop.run_forever()
except KeyboardInterrupt:
keyboard_interrupted = True
if repl_future and not repl_future.done():
repl_future.cancel()
repl_thread.interrupt()
Expand Down
Loading