Windows
=======
+.. versionchanged:: 3.8
+
+ On Windows, :class:`ProactorEventLoop` is now the default event loop.
+
All event loops on Windows do not support the following methods:
* :meth:`loop.create_unix_connection` and
Subprocess Support on Windows
-----------------------------
-:class:`SelectorEventLoop` on Windows does not support subproceses.
-On Windows, :class:`ProactorEventLoop` should be used instead::
-
- import asyncio
-
- asyncio.set_event_loop_policy(
- asyncio.WindowsProactorEventLoopPolicy())
-
- asyncio.run(your_code())
-
+On Windows, the default event loop :class:`ProactorEventLoop` supports
+subprocesses, whereas :class:`SelectorEventLoop` does not.
The :meth:`policy.set_child_watcher()
<AbstractEventLoopPolicy.set_child_watcher>` function is also
.. class:: DefaultEventLoopPolicy
The default asyncio policy. Uses :class:`SelectorEventLoop`
- on both Unix and Windows platforms.
+ on Unix and :class:`ProactorEventLoop` on Windows.
There is no need to install the default policy manually. asyncio
is configured to use the default policy automatically.
+ .. versionchanged:: 3.8
+
+ On Windows, :class:`ProactorEventLoop` is now used by default.
+
+
+.. class:: WindowsSelectorEventLoopPolicy
+
+ An alternative event loop policy that uses the
+ :class:`SelectorEventLoop` event loop implementation.
+
+ Availability: Windows.
+
.. class:: WindowsProactorEventLoopPolicy
Improved Modules
================
+asyncio
+-------
+
+On Windows, the default event loop is now :class:`~asyncio.ProactorEventLoop`.
+
os.path
-------
_loop_factory = ProactorEventLoop
-DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
+DefaultEventLoopPolicy = WindowsProactorEventLoopPolicy
def setUp(self):
super().setUp()
- self.loop = asyncio.new_event_loop()
+ self.loop = asyncio.SelectorEventLoop()
self.set_event_loop(self.loop)
@mock.patch('socket.getnameinfo')
addr = q.get()
# Should not be stuck in an infinite loop.
- with self.assertRaises((ConnectionResetError, BrokenPipeError)):
+ with self.assertRaises((ConnectionResetError, ConnectionAbortedError,
+ BrokenPipeError)):
self.loop.run_until_complete(client(*addr))
# Clean up the thread. (Only on success; on failure, it may
--- /dev/null
+On Windows, asyncio now uses ProactorEventLoop, instead of
+SelectorEventLoop, by default.