Parse _version contents instead of using exec() #8050
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.
Our Python 3.13 jobs have started failing in GitHub Actions - https://github.com/python-pillow/Pillow/actions/runs/9032048835/job/24819485997#step:9:46
This is referring to
Pillow/setup.py
Lines 23 to 27 in 0cad346
Python 3.13 is failing to populate the local variables from
exec()
- python/cpython#118888We have various options at this point.
exec()
for this (originally added in RFC: Specify Version in one place #2517), and instead just simply parse the version string out of_version.py
after reading the file contents.This PR suggests Option 3. I don't mind if this is declined, it merely seems like a straightforward solution with no obvious downsides - if
_version.py
ever changes in the future so that this parsing code doesn't work,get_version()
can be changed again.