-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [task] [WIP] #13670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. First step: tasks.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please handle DeprecationWarning
in the tests. Running with -Werror
would give test failures due to warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @tirkarthi
./python -Werror -m test
should pass
You can find the following command useful in development:
`./python -Werror -m test -v test_asyncio"
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the PR with ./python -Werror -m test --check-env-changed -v test_asyncio
and make sure that the test run is succeded.
Lib/asyncio/tasks.py
Outdated
@@ -659,6 +672,10 @@ class _GatheringFuture(futures.Future): | |||
""" | |||
|
|||
def __init__(self, children, *, loop=None): | |||
if loop: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant: asyncio.gather()
always passes loop
to internal _GatheringFuture
constructor.
Lib/asyncio/tasks.py
Outdated
@@ -116,6 +116,10 @@ def all_tasks(cls, loop=None): | |||
return _all_tasks_compat(loop) | |||
|
|||
def __init__(self, coro, *, loop=None, name=None): | |||
if loop: | |||
warnings.warn("The loop argument is deprecated since Python 3.8, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Task
is called with explicit loop
by loop.create_task()
method, please drop the check
Codecov Report
@@ Coverage Diff @@
## master #13670 +/- ##
==========================================
- Coverage 82.78% 82.78% -0.01%
==========================================
Files 1842 1842
Lines 559265 559276 +11
Branches 41382 41387 +5
==========================================
- Hits 463009 462990 -19
- Misses 87188 87209 +21
- Partials 9068 9077 +9
Continue to review full report at Codecov.
|
The work is merged as a part of #16033 |
This PR deprecate explicit loop parameters in all public asyncio APIs
This issues is split to be easier to review.
First step: tasks.py
https://bugs.python.org/issue36373