-
-
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
ClientSession.close
deprecated when called directly via run_until_complete(2.2.3)
#2065
Comments
I pretty sure the issue is fixed by 97db67b and e176536. |
@asvetlov |
Sure :) |
Fixed by @2161 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
When you close session directly via
loop.run_until_complete(session.close())
, it is deprecated.The reason is that
_CoroGuard
inherits from_BaseCoroMixin
that inherits fromcollections.abc.Coroutine
.https://github.com/aio-libs/aiohttp/blob/v2.2.3/aiohttp/helpers.py#L108
And when calling
loop.run_until_complete(session.close())
then__await__
or__iter__
methods are unreachable,send
method is called instead. That's why,self._awaited
attribute is not changed toTrue
.Expected behaviour
Direct closing
loop.run_until_complete(session.close())
is not deprecatedActual behaviour
Direct closing
loop.run_until_complete(session.close())
is deprecatedSteps to reproduce
Your environment
The text was updated successfully, but these errors were encountered: