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
1545287d
Commit
1545287d
authored
Nov 07, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28613: Expose asyncio._get_running_loop() and _set_running_loop()
parent
7b7bd1fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
Lib/asyncio/events.py
Lib/asyncio/events.py
+1
-0
Lib/test/test_asyncio/test_events.py
Lib/test/test_asyncio/test_events.py
+4
-0
No files found.
Lib/asyncio/events.py
View file @
1545287d
...
...
@@ -6,6 +6,7 @@ __all__ = ['AbstractEventLoopPolicy',
'get_event_loop_policy'
,
'set_event_loop_policy'
,
'get_event_loop'
,
'set_event_loop'
,
'new_event_loop'
,
'get_child_watcher'
,
'set_child_watcher'
,
'_set_running_loop'
,
'_get_running_loop'
,
]
import
functools
...
...
Lib/test/test_asyncio/test_events.py
View file @
1545287d
...
...
@@ -2732,9 +2732,11 @@ class PolicyTests(unittest.TestCase):
try
:
asyncio
.
set_event_loop_policy
(
Policy
())
loop
=
asyncio
.
new_event_loop
()
self
.
assertIs
(
asyncio
.
_get_running_loop
(),
None
)
async
def
func
():
self
.
assertIs
(
asyncio
.
get_event_loop
(),
loop
)
self
.
assertIs
(
asyncio
.
_get_running_loop
(),
loop
)
loop
.
run_until_complete
(
func
())
finally
:
...
...
@@ -2742,6 +2744,8 @@ class PolicyTests(unittest.TestCase):
if
loop
is
not
None
:
loop
.
close
()
self
.
assertIs
(
asyncio
.
_get_running_loop
(),
None
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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