* Exceptions occurring in cancelled tasks are no longer logged.
(Contributed by Yury Selivanov in :issue:`30508`.)
+* New ``WindowsSelectorEventLoopPolicy`` and
+ ``WindowsProactorEventLoopPolicy`` classes.
+ (Contributed by Yury Selivanov in :issue:`33792`.)
+
Several ``asyncio`` APIs have been
:ref:`deprecated <whatsnew37-asyncio-deprecated>`.
__all__ = (
'SelectorEventLoop', 'ProactorEventLoop', 'IocpProactor',
- 'DefaultEventLoopPolicy',
+ 'DefaultEventLoopPolicy', 'WindowsSelectorEventLoopPolicy',
+ 'WindowsProactorEventLoopPolicy',
)
SelectorEventLoop = _WindowsSelectorEventLoop
-class _WindowsDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
+class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory = SelectorEventLoop
-DefaultEventLoopPolicy = _WindowsDefaultEventLoopPolicy
+class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
+ _loop_factory = ProactorEventLoop
+
+
+DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
fut.cancel()
+class WinPolicyTests(test_utils.TestCase):
+
+ def test_selector_win_policy(self):
+ async def main():
+ self.assertIsInstance(
+ asyncio.get_running_loop(),
+ asyncio.SelectorEventLoop)
+
+ old_policy = asyncio.get_event_loop_policy()
+ try:
+ asyncio.set_event_loop_policy(
+ asyncio.WindowsSelectorEventLoopPolicy())
+ asyncio.run(main())
+ finally:
+ asyncio.set_event_loop_policy(old_policy)
+
+ def test_proactor_win_policy(self):
+ async def main():
+ self.assertIsInstance(
+ asyncio.get_running_loop(),
+ asyncio.ProactorEventLoop)
+
+ old_policy = asyncio.get_event_loop_policy()
+ try:
+ asyncio.set_event_loop_policy(
+ asyncio.WindowsProactorEventLoopPolicy())
+ asyncio.run(main())
+ finally:
+ asyncio.set_event_loop_policy(old_policy)
+
+
if __name__ == '__main__':
unittest.main()
--- /dev/null
+Add asyncio.WindowsSelectorEventLoopPolicy and
+asyncio.WindowsProactorEventLoopPolicy.