Repository navigation
Conversation
Python 3.15 removed SourceFileLoader.load_module(), so the module-level imports in tests/test_low_findings.py raise AttributeError and the whole suite fails to load. selftest.yml floats on python-version '3.x', so CI breaks as soon as setup-python resolves to 3.15. Load gen-sbom, sbom-driver.py and compdb_sbom.py through spec_from_loader + exec_module, the shape test_gen_sbom.py and test_sbom_identity.py already use, and do the same in the /dev/stdout subprocess snippet. Tested on Python 3.9.6, 3.14 and 3.15.0.
macro_name() passed maxsplit to re.split positionally. Python 3.13 deprecated that form and a later release will reject it, which would break the compile_commands.json frontend in every product that vendors it. Passing it by keyword works on every supported Python. Tested with -W error::DeprecationWarning on Python 3.9.6, 3.14 and 3.15.0.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused compatibility changes preserve intended behavior, with no identified blocking issues.
No open issues 🎉
What changed in this PR
Updates test loading and the compilation-database frontend for Python 3.15 compatibility.
Changes:
- Replaces removed
load_module()calls withexec_module(). - Passes
re.split’smaxsplitargument by keyword to avoid deprecation warnings.
| File | Description |
|---|---|
| tests/test_low_findings.py | Modernizes module loading in tests and subprocess code. |
| share/frontends/compdb_sbom.py | Uses keyword syntax for maxsplit. |
Review effort: Balanced
2 of 4 tasks
Member
Author
|
Closing as #36 now contains the same fixes and will go in first. |
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.
selftest.ymlusespython-version: '3.x', so CI starts failing as soon as setup-python resolves to 3.15.tests/test_low_findings.pycalledSourceFileLoader.load_module(), which 3.15 removed, so the whole suite failed to load. It now usesspec_from_loader+exec_module, like the other test files.compdb_sbom.pypassedmaxsplittore.splitpositionally, which 3.13 deprecated. It now passes it by keyword.Tested on Python 3.9.6, 3.14 and 3.15.0, the compdb change also with
-W error::DeprecationWarning.