Close unclosed client sessions properly #2523
Conversation
It's a complex question. If the loop is closed before On other hand the session could be dropped in coroutine context:
In this case the loop is running, |
Yeah, I suspected it’s not clear cut. I’d suggest to either drop the close altogether or wrap it in a |
I think dropping is just fine. |
Codecov Report
@@ Coverage Diff @@
## master #2523 +/- ##
==========================================
- Coverage 97.13% 97.13% -0.01%
==========================================
Files 39 39
Lines 8066 8065 -1
Branches 1414 1414
==========================================
- Hits 7835 7834 -1
Misses 99 99
Partials 132 132
Continue to review full report at Codecov.
|
* Close unclosed client sessions properly * Add news fragment * Drop it all together
Thanks! |
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. |
What do these changes do?
ClientSession.__del__
uses a bareself.close()
which causes a warning. This fixes that warning. I think this should be fine like that?Are there changes in behavior for the user?
One warning less.
Related issue number
n/a
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bug)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.