Repository navigation
Conversation
Collaborator
Author
|
Oops, looks like @danmar already merged in a fix. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the explicit file ownership and cleanup changes.
No open issues 🎉
What changed in this PR
Addresses Python 3.15 resource warnings that cause addon tests to fail under -Werror, separating the file-handling fix from the broader changes in #8819.
Changes:
- Passes explicitly opened binary files to
ElementTree.iterparsein both parsing methods. - Uses context managers to close files when parsing exits or the configuration generator closes, preserving existing parsing logic.
| File | Description |
|---|---|
addons/cppcheckdata.py |
Adds explicit file ownership and cleanup to CppcheckData.__init__ and iterconfigurations(), with corresponding re-indentation and explanatory comments. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The
build (macos-15)job started failing because the runner's Homebrew Python moved from 3.14 to 3.15. The addon tests run pytest with-Werror, and Python 3.15 emitsResourceWarning: unclosed iterparse iteratorwhen aniterparseiterator that opened its own file is dropped before it is exhausted.cppcheckdata.pydoes that in two places:CppcheckData.__init__breaks out of the loop once it has the platform, raw tokens and suppressions, anditerconfigurations()is a generator that the caller can abandon early. The warning turned 11 addon tests into failures.The change passes
iterparsea file object opened in awithblock instead of the filename. Theniterparsedoesn't own the file, so there is nothing for Python 3.15 to warn about, and the file is closed when the block exits regardless of how the loop ends. Older Pythons behave the same as before. The rest of the diff is re-indentation of the loop bodies.This is actually the same change was made in #8819, but this is moved out into a seperate PR so other PRs can start passing CI.