-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ignore the ResourceWarnings before they become unraisable exceptions #6872
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6872 +/- ##
=======================================
Coverage 93.44% 93.44%
=======================================
Files 104 104
Lines 30629 30630 +1
Branches 3076 3079 +3
=======================================
+ Hits 28621 28622 +1
Misses 1838 1838
Partials 170 170
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Backport to 3.9: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 799dc87 on top of patchback/backports/3.9/799dc8742e2cc0b5a819ba454878d09bbfe2df82/pr-6872 Backporting merged PR #6872 into master
🤖 @patchback |
ignore:Exception ignored in. <coroutine object ClientSession._request at 0x.:pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception | ||
ignore:Exception ignored in. <function ClientSession.__del__ at 0x.:pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception | ||
ignore:Exception ignored in. <_io.FileIO .closed.>:pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception | ||
ignore:unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0x.*:ResourceWarning |
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.
@graingert any suggestions on how to make this scoped to a single module?
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.
You'll have to talk to @vstinner on how to get per module resource warnings
You can dig out the original owner of the object via tracemalloc but it slows down python considerably, The issue being tracemalloc is great and gives you all the info you need, but it's too slow to run all the time, also resources warnings are flakey which means by the time you see one it's too late and you weren't running tracemalloc
What I think should happen is that:
- When any object with a custom
__del__
is being constructed - If the ResourceWarning filter is configured as "error"
- the frame module, filename and line number 2 frames above the last
__init__
call is recorded, as a sort of tracemalloc of last-resort
Then when the ResourceWarning is raised it's associated with those lines
This change updates the pytest configuration to defeat the unintentional resource leaks caused by an incorrect method of suppressing the `PytestUnraisableExceptionWarning`s. Contributed by Thomas Grainger. (cherry picked from commit 799dc87)
Also backported to 3.8 as 4d10cc9 |
Backport to 3.8: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 799dc87 on top of patchback/backports/3.8/799dc8742e2cc0b5a819ba454878d09bbfe2df82/pr-6872 Backporting merged PR #6872 into master
🤖 @patchback |
What do these changes do?
Are there changes in behavior for the user?
nope
Related issue number
#6872
Checklist
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.