From 5431e0e8d94a0a2e93d4da4afd709f8714fafa47 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 9 Jun 2024 09:23:58 -0500 Subject: [PATCH] COMP: Fix python wrapping build state to match python version 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. --- Wrapping/macro_files/itk_end_wrap_module.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Wrapping/macro_files/itk_end_wrap_module.cmake b/Wrapping/macro_files/itk_end_wrap_module.cmake index fd7aa99c95e..5378cf835a9 100644 --- a/Wrapping/macro_files/itk_end_wrap_module.cmake +++ b/Wrapping/macro_files/itk_end_wrap_module.cmake @@ -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})