Skip to content
Closed
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
5 changes: 4 additions & 1 deletion Lib/asyncio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import threading
import types
import warnings
import contextvars

from . import futures

Expand All @@ -25,6 +26,7 @@ def runcode(self, code):
def callback():
global repl_future
global repl_future_interrupted
global repl_context

repl_future = None
repl_future_interrupted = False
Expand Down Expand Up @@ -52,7 +54,7 @@ def callback():
except BaseException as exc:
future.set_exception(exc)

loop.call_soon_threadsafe(callback)
loop.call_soon_threadsafe(callback, context=repl_context)

try:
return future.result()
Expand Down Expand Up @@ -103,6 +105,7 @@ def run(self):

repl_future = None
repl_future_interrupted = False
repl_context = contextvars.Context()

try:
import readline # NoQA
Expand Down