GeezerVison is showing github.com — gh-116731: Fix refleaks in importlib tests by jaraco · Pull Request #116763 · python/cpython
Conversation
jaraco
commented
Mar 13, 2024
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
- In PathFinder.invalidate_caches, also invoke MetadataPathFinder.invalidate_caches.
- Invoke invalidate_caches in tests exhibiting refleaks.
- Address ref leak in inspect triggered by call to
files().
- Add blurb
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
jaraco
changed the title
Fix refleaks in importlib tests
gh-116731: Fix refleaks in importlib tests
Mar 13, 2024
|
With these changes, refleaks checks now pass:
cpython gh-116731/importlib-refleaks @ ./python.exe -m test test_importlib -R 3:3
Using random seed: 894808194
0:00:00 load avg: 1.17 Run 1 test sequentially
0:00:00 load avg: 1.17 [1/1] test_importlib
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX. 12.
test_importlib leaked [1, 2, 0] references, sum=3 (this is fine)
test_importlib leaked [1, 1, 0] memory blocks, sum=2 (this is fine)
== Tests result: SUCCESS ==
1 test OK.
Total duration: 14.0 sec
Total tests: run=1,274 skipped=6
Total test files: run=1/1
Result: SUCCESS
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+1473
to
+1474
|
|
from importlib.metadata import MetadataPathFinder
|
|
|
MetadataPathFinder().invalidate_caches()
|
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.
@brettcannon I included you in the review for this section. Any concerns with adding this hook here?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @jaraco for commit b33e4d5 🤖
If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @jaraco for commit b33e4d5 🤖
If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I believe this build was the one triggered for refleaks. It looks like it may have failed to start.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This is superseded by a cleaner approach in #116805. I still think MetadataPathFinder.invalidate_caches should be called from PathFinder.invalidate_caches, as that will match the behavior that would happen if MetadataPathFinder were on sys.meta_path. I'll track that in a separate issue.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
brettcannon
Awaiting requested review from brettcannon
brettcannon is a code owner
vstinner
Awaiting requested review from vstinner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|