-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Encourage creation of aiohttp public objects inside a coroutine #3333
Conversation
May be i should rebase those two commits for test ? @asvetlov |
@ZYunH towncrier fails on python 3.6, |
@gyermolenko thx! i will fix this case |
aiohttp/base_protocol.py
Outdated
@@ -10,7 +11,7 @@ class BaseProtocol(asyncio.Protocol): | |||
|
|||
def __init__(self, loop: Optional[asyncio.AbstractEventLoop]=None) -> None: | |||
if loop is None: | |||
self._loop = asyncio.get_event_loop() | |||
self._loop = get_running_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.
The idea is replacing the entire if loop is None
block with self._loop = get_running_loop(loop)
.
The change doesn't only remove several lines but always check a loop (explicit or implicit) for running.
Please apply it everywhere.
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.
Got you.I will do this.
BTW,is there any plan to use asyncio.get_running_loop() which is a new api in python3.7 ?
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.
Eventually yes, but we should support Python 3.5 and 3.6 for a long time
I think it is simple at first, but it is wrong.There is still a lot of work to be done for test infra.Is there any easy way to make the test infra(more than 200 DeprecationWarning in test suites)? |
Test suite disables default event loop, this is why you see In general converting Please fix trivial cases and let me know, I'll pick up the PR and finish it if needed. |
@asvetlov Thanks for reply! Now these commits only do
No unit tests for the changes |
|
Now i can't access this PR, because previous fork is deleted for next fix.Pick up this PR if you need. |
Done in a separate commit |
Replace asyncio.get_event_loop() with get_running_loop()
Nope
Nope
#3331
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.