Skip to content

Commit 741ca2a

Browse files
committed
Remove asyncio patching for async able to use create_subprocess_exec on windows
Removed the _init_asyncio_patch method and its calls.
1 parent 4b37e75 commit 741ca2a

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

ipykernel/kernelapp.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -643,43 +643,6 @@ def configure_tornado_logger(self):
643643
handler.setFormatter(formatter)
644644
logger.addHandler(handler)
645645

646-
def _init_asyncio_patch(self):
647-
"""set default asyncio policy to be compatible with tornado
648-
649-
Tornado 6 (at least) is not compatible with the default
650-
asyncio implementation on Windows
651-
652-
Pick the older SelectorEventLoopPolicy on Windows
653-
if the known-incompatible default policy is in use.
654-
655-
Support for Proactor via a background thread is available in tornado 6.1,
656-
but it is still preferable to run the Selector in the main thread
657-
instead of the background.
658-
659-
do this as early as possible to make it a low priority and overridable
660-
661-
ref: https://github.com/tornadoweb/tornado/issues/2608
662-
663-
FIXME: if/when tornado supports the defaults in asyncio without threads,
664-
remove and bump tornado requirement for py38.
665-
Most likely, this will mean a new Python version
666-
where asyncio.ProactorEventLoop supports add_reader and friends.
667-
668-
"""
669-
if sys.platform.startswith("win"):
670-
import asyncio
671-
672-
try:
673-
from asyncio import WindowsProactorEventLoopPolicy, WindowsSelectorEventLoopPolicy
674-
except ImportError:
675-
pass
676-
# not affected
677-
else:
678-
if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
679-
# WindowsProactorEventLoopPolicy is not compatible with tornado 6
680-
# fallback to the pre-3.8 default of Selector
681-
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
682-
683646
def init_pdb(self):
684647
"""Replace pdb with IPython's version that is interruptible.
685648
@@ -699,7 +662,6 @@ def init_pdb(self):
699662
@catch_config_error
700663
def initialize(self, argv=None):
701664
"""Initialize the application."""
702-
self._init_asyncio_patch()
703665
super().initialize(argv)
704666
if self.subapp is not None:
705667
return

0 commit comments

Comments
 (0)