gh-102251: Updates to test_imp Toward Fixing Some Refleaks #102254
Merged
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.
This includes some cleanup, some tweaks to the existing tests, and a bunch of new test cases. It is all related to fixing the refleaks introduced by 096d009. I haven't been able to find the leak yet, but these changes are a consequence of that effort.
The only change here that might have impact outside the tests in question is in imp.py, where I update
imp.load_dynamic()to usespec_from_file_location()instead of creating aModuleSpecdirectly. (See commit 0c65700 below.)Also note that I've updated the tests to only skip if we're checking for refleaks (regrtest's
--huntrleaks), whereas in gh-101969 I had skipped the tests entirely. The tests will be useful for some upcoming work and I'd rather the refleaks not hold that up. (It isn't clear how quickly we'll be able to fix the leaking code, though it will certainly be done in the short term.)