diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 91b7a7f8466..a424716f0aa 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -22,16 +22,31 @@ from homeassistant.const import ( def set_loop() -> None: """Attempt to use uvloop.""" import asyncio + from asyncio.events import BaseDefaultEventLoopPolicy + + policy = None if sys.platform == 'win32': - asyncio.set_event_loop(asyncio.ProactorEventLoop()) + if hasattr(asyncio, 'WindowsProactorEventLoopPolicy'): + # pylint: disable=no-member + policy = asyncio.WindowsProactorEventLoopPolicy() + else: + class ProactorPolicy(BaseDefaultEventLoopPolicy): + """Event loop policy to create proactor loops.""" + + _loop_factory = asyncio.ProactorEventLoop + + policy = ProactorPolicy() else: try: import uvloop except ImportError: pass else: - asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) + policy = uvloop.EventLoopPolicy() + + if policy is not None: + asyncio.set_event_loop_policy(policy) def validate_python() -> None: diff --git a/homeassistant/const.py b/homeassistant/const.py index 6ae08af5047..59d19d2b29a 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 79 -PATCH_VERSION = '2' +PATCH_VERSION = '3' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 5, 3)