Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8f404296
Commit
8f404296
authored
Jun 07, 2018
by
Yury Selivanov
Committed by
GitHub
Jun 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-33792: Add selector and proactor windows policies (GH-7487)
parent
52698c7a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
Doc/whatsnew/3.7.rst
Doc/whatsnew/3.7.rst
+4
-0
Lib/asyncio/windows_events.py
Lib/asyncio/windows_events.py
+8
-3
Lib/test/test_asyncio/test_windows_events.py
Lib/test/test_asyncio/test_windows_events.py
+31
-0
Misc/NEWS.d/next/Library/2018-06-07-12-38-12.bpo-33792.3aKG7u.rst
...S.d/next/Library/2018-06-07-12-38-12.bpo-33792.3aKG7u.rst
+2
-0
No files found.
Doc/whatsnew/3.7.rst
View file @
8f404296
...
...
@@ -733,6 +733,10 @@ include:
* 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>`.
...
...
Lib/asyncio/windows_events.py
View file @
8f404296
...
...
@@ -21,7 +21,8 @@ from .log import logger
__all__
=
(
'SelectorEventLoop'
,
'ProactorEventLoop'
,
'IocpProactor'
,
'DefaultEventLoopPolicy'
,
'DefaultEventLoopPolicy'
,
'WindowsSelectorEventLoopPolicy'
,
'WindowsProactorEventLoopPolicy'
,
)
...
...
@@ -801,8 +802,12 @@ class _WindowsSubprocessTransport(base_subprocess.BaseSubprocessTransport):
SelectorEventLoop
=
_WindowsSelectorEventLoop
class
_WindowsDefault
EventLoopPolicy
(
events
.
BaseDefaultEventLoopPolicy
):
class
WindowsSelector
EventLoopPolicy
(
events
.
BaseDefaultEventLoopPolicy
):
_loop_factory
=
SelectorEventLoop
DefaultEventLoopPolicy
=
_WindowsDefaultEventLoopPolicy
class
WindowsProactorEventLoopPolicy
(
events
.
BaseDefaultEventLoopPolicy
):
_loop_factory
=
ProactorEventLoop
DefaultEventLoopPolicy
=
WindowsSelectorEventLoopPolicy
Lib/test/test_asyncio/test_windows_events.py
View file @
8f404296
...
...
@@ -166,5 +166,36 @@ class ProactorTests(test_utils.TestCase):
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
()
Misc/NEWS.d/next/Library/2018-06-07-12-38-12.bpo-33792.3aKG7u.rst
0 → 100644
View file @
8f404296
Add asyncio.WindowsSelectorEventLoopPolicy and
asyncio.WindowsProactorEventLoopPolicy.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment