m4: fix Python 3.13/3.14 detection and empty version string crash#26
Open
blshkv wants to merge 2 commits into
Open
m4: fix Python 3.13/3.14 detection and empty version string crash#26blshkv wants to merge 2 commits into
blshkv wants to merge 2 commits into
Conversation
Add local copies of ax_python.m4 and ax_python_devel.m4 to m4/ so
they override the system autoconf-archive versions.
Two fixes:
1. ax_python.m4: extend the Python binary search list to include
python3.13 and python3.14. Without this, configure fails to detect
Python 3.13+ and PYTHON_INCLUDE_DIR stays empty, causing:
fatal error: pyconfig.h: No such file or directory
2. ax_python_devel.m4: guard vtup() against an empty version string.
AX_PYTHON_DEVEL is called with ">= '$PYTHON_VERSION'" where
PYTHON_VERSION can be empty if the detected binary is plain
"python" with no version suffix. vtup() then calls int('') which
raises ValueError. Return () for an empty string so the comparison
always succeeds.
Fixes: pst-format#25
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a local copy of ax_boost_python.m4 in m4/, aclocal fails to include it and configure exits with: ./configure: line NNNNN: AX_BOOST_PYTHON: command not found Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16bd1d1 to
60de6f2
Compare
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.
Summary
m4/ax_python.m4withpython3.13/python3.14added to the binary search list, anddistutilsreplaced withsysconfigm4/ax_python_devel.m4with a guard invtup()against an empty version stringm4/ax_boost_python.m4soAX_BOOST_PYTHONis available to aclocalDetails
Fix 1: Python 3.13/3.14 not detected (
ax_python.m4)The
for python in ...loop stopped atpython3.12, so Python 3.13+ was never found.PYTHON_INCLUDE_DIRstayed empty, causing:Fix 2:
distutilsremoved in Python 3.12+ (ax_python.m4)The header path was obtained via:
distutilswas removed in Python 3.12. Replaced with:Fix 3:
vtup()crashes on empty version string (ax_python_devel.m4)AX_PYTHON_DEVELis called with>= '$PYTHON_VERSION'. Ifax_python_binis plainpython(no version suffix),cut -c7-produces an empty string.vtup('')then callsint('')which raisesValueError.def vtup(self, s): + if not s.strip(): return () return tuple(map(int, s.strip().replace("rc", ".").split(".")))Fix 4:
AX_BOOST_PYTHONnot found (ax_boost_python.m4)Without a local copy of
ax_boost_python.m4inm4/, aclocal fails to include it and configure exits with:Closes #25
🤖 Generated with Claude Code