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
0de3de6c
Commit
0de3de6c
authored
Oct 05, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28371: Deprecate passing asyncio.Handles to run_in_executor.
parent
3e56ff0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+3
-0
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+6
-3
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/asyncio/base_events.py
View file @
0de3de6c
...
...
@@ -605,6 +605,9 @@ class BaseEventLoop(events.AbstractEventLoop):
if
isinstance
(
func
,
events
.
Handle
):
assert
not
args
assert
not
isinstance
(
func
,
events
.
TimerHandle
)
warnings
.
warn
(
"Passing Handle to loop.run_in_executor() is deprecated"
,
DeprecationWarning
)
if
func
.
_cancelled
:
f
=
self
.
create_future
()
f
.
set_result
(
None
)
...
...
Lib/test/test_asyncio/test_base_events.py
View file @
0de3de6c
...
...
@@ -358,7 +358,8 @@ class BaseEventLoopTests(test_utils.TestCase):
h
=
asyncio
.
Handle
(
cb
,
(),
self
.
loop
)
h
.
cancel
()
f
=
self
.
loop
.
run_in_executor
(
None
,
h
)
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"Passing Handle"
):
f
=
self
.
loop
.
run_in_executor
(
None
,
h
)
self
.
assertIsInstance
(
f
,
asyncio
.
Future
)
self
.
assertTrue
(
f
.
done
())
self
.
assertIsNone
(
f
.
result
())
...
...
@@ -373,12 +374,14 @@ class BaseEventLoopTests(test_utils.TestCase):
self
.
loop
.
set_default_executor
(
executor
)
res
=
self
.
loop
.
run_in_executor
(
None
,
h
)
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"Passing Handle"
):
res
=
self
.
loop
.
run_in_executor
(
None
,
h
)
self
.
assertIs
(
f
,
res
)
executor
=
mock
.
Mock
()
executor
.
submit
.
return_value
=
f
res
=
self
.
loop
.
run_in_executor
(
executor
,
h
)
with
self
.
assertWarnsRegex
(
DeprecationWarning
,
"Passing Handle"
):
res
=
self
.
loop
.
run_in_executor
(
executor
,
h
)
self
.
assertIs
(
f
,
res
)
self
.
assertTrue
(
executor
.
submit
.
called
)
...
...
Misc/NEWS
View file @
0de3de6c
...
...
@@ -356,6 +356,8 @@ Library
-
Issue
#
28370
:
Speedup
asyncio
.
StreamReader
.
readexactly
.
Patch
by
Коренберг
Марк
.
-
Issue
#
28371
:
Deprecate
passing
asyncio
.
Handles
to
run_in_executor
.
IDLE
----
...
...
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