Skip to content

Commit f20c034

Browse files
author
Quentin Peter
committed
Merge remote-tracking branch 'upstream/master' into Update_comms_matplotlib
2 parents 922bb55 + efed7bf commit f20c034

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

docs/changelog.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ Changes in IPython kernel
44
5.1
55
---
66

7+
5.1.3
8+
*****
9+
10+
5.1.3 Includes several bugfixes and internal logic improvements.
11+
12+
- Fix comm shutdown behavior by adding a ``deleting`` option to ``close`` which can be set to prevent registering new comm channels during shutdown (:ghpull: `433`, :ghpull: `435`)
13+
- Fix ``Heartbeat._bind_socket`` to return on the first bind (:ghpull: `431`)
14+
- Moved ``InProcessKernelClient.flush`` to ``DummySocket`` (:gphull: `437`)
15+
- Don't redirect stdout if nose machinery is not present (:ghpull: `427`)
16+
- Rename `_asyncio.py` to `_asyncio_utils.py` to avoid name conflicts on Python 3.6+ (:ghpull: `426`)
17+
- Only generate kernelspec when installing or building wheel (:ghpull: `425`)
18+
- Fix priority ordering of control-channel messages in some cases (:ghpull:`443`)
19+
20+
721
5.1.2
822
*****
923

ipykernel/kernelapp.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,45 @@ def configure_tornado_logger(self):
514514
handler.setFormatter(formatter)
515515
logger.addHandler(handler)
516516

517+
def _init_asyncio_patch(self):
518+
"""set default asyncio policy to be compatible with tornado
519+
520+
Tornado 6 (at least) is not compatible with the default
521+
asyncio implementation on Windows
522+
523+
Pick the older SelectorEventLoopPolicy on Windows
524+
if the known-incompatible default policy is in use.
525+
526+
do this as early as possible to make it a low priority and overrideable
527+
528+
ref: https://github.com/tornadoweb/tornado/issues/2608
529+
530+
FIXME: if/when tornado supports the defaults in asyncio,
531+
remove and bump tornado requirement for py38
532+
"""
533+
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
534+
import asyncio
535+
try:
536+
from asyncio import (
537+
WindowsProactorEventLoopPolicy,
538+
WindowsSelectorEventLoopPolicy,
539+
)
540+
except ImportError:
541+
pass
542+
# not affected
543+
else:
544+
if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
545+
# WindowsProactorEventLoopPolicy is not compatible with tornado 6
546+
# fallback to the pre-3.8 default of Selector
547+
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
548+
517549
@catch_config_error
518550
def initialize(self, argv=None):
551+
self._init_asyncio_patch()
519552
super(IPKernelApp, self).initialize(argv)
520553
if self.subapp is not None:
521554
return
522-
# register zmq IOLoop with tornado
523-
zmq_ioloop.install()
555+
524556
self.init_blackhole()
525557
self.init_connection_file()
526558
self.init_poller()

0 commit comments

Comments
 (0)