Skip to content

Commit

Permalink
COMP: Fix python wrapping build state to match python version
Browse files Browse the repository at this point in the history
If initially configured with python >= 3.11 before selecting a
python version <3.11 as the python environment, then the
state of the ITK(USE_PYTHON_LIMITED_API was incorrecly
cached to retain the compiler settings desired for
building with the original 3.11 python version.

Py_buffer is only included as part of the limited
python API in 3.11 or greater versions.

Compilation would fail due to building with
-DPy_LIMITED_API to restrict the python interfaces
available.
  • Loading branch information
hjmjohnson committed Jun 11, 2024
1 parent ef738d1 commit 5431e0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Wrapping/macro_files/itk_end_wrap_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,9 @@ ${DO_NOT_WAIT_FOR_THREADS_CALLS}
if(ITK_WRAP_PYTHON_VERSION VERSION_GREATER_EQUAL 3.11)
set(use_python_limited_api_default 1)
endif()
set(ITK_USE_PYTHON_LIMITED_API ${use_python_limited_api_default} CACHE BOOL "Use Python's limited API for Python minor version compatibility.")
set(ITK_USE_PYTHON_LIMITED_API ${use_python_limited_api_default} CACHE BOOL "Use Python's limited API for Python minor version compatibility." FORCE)
mark_as_advanced(ITK_USE_PYTHON_LIMITED_API)
unset(use_python_limited_api_default)

# build all the c++ files from this module in a common lib
if(NOT TARGET ${lib})
Expand Down

0 comments on commit 5431e0e

Please sign in to comment.