Skip to content

Commit 07f7437

Browse files
authored
Enable ProactorEventLoop on windows for ipykernel (#1184)
1 parent 4001f8a commit 07f7437

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
@@ -624,43 +624,6 @@ def configure_tornado_logger(self):
624624
handler.setFormatter(formatter)
625625
logger.addHandler(handler)
626626

627-
def _init_asyncio_patch(self):
628-
"""set default asyncio policy to be compatible with tornado
629-
630-
Tornado 6 (at least) is not compatible with the default
631-
asyncio implementation on Windows
632-
633-
Pick the older SelectorEventLoopPolicy on Windows
634-
if the known-incompatible default policy is in use.
635-
636-
Support for Proactor via a background thread is available in tornado 6.1,
637-
but it is still preferable to run the Selector in the main thread
638-
instead of the background.
639-
640-
do this as early as possible to make it a low priority and overridable
641-
642-
ref: https://github.com/tornadoweb/tornado/issues/2608
643-
644-
FIXME: if/when tornado supports the defaults in asyncio without threads,
645-
remove and bump tornado requirement for py38.
646-
Most likely, this will mean a new Python version
647-
where asyncio.ProactorEventLoop supports add_reader and friends.
648-
649-
"""
650-
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
651-
import asyncio
652-
653-
try:
654-
from asyncio import WindowsProactorEventLoopPolicy, WindowsSelectorEventLoopPolicy
655-
except ImportError:
656-
pass
657-
# not affected
658-
else:
659-
if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
660-
# WindowsProactorEventLoopPolicy is not compatible with tornado 6
661-
# fallback to the pre-3.8 default of Selector
662-
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
663-
664627
def init_pdb(self):
665628
"""Replace pdb with IPython's version that is interruptible.
666629
@@ -680,7 +643,6 @@ def init_pdb(self):
680643
@catch_config_error
681644
def initialize(self, argv=None):
682645
"""Initialize the application."""
683-
self._init_asyncio_patch()
684646
super().initialize(argv)
685647
if self.subapp is not None:
686648
return

0 commit comments

Comments
 (0)