From 6b55259ced7581a91216f7bde27309162e32f559 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Sun, 6 Sep 2026 10:40:03 -0500 Subject: [PATCH 1/2] COMP: Label wrapped tests with their own module itk_python_add_test reaches itk_add_test, which labels a test with ${itk-module}. That variable is not set in the wrapping test scope, so every Python test inherited whichever module was configured last. The effect was that "ctest -L ITKVtkGlue" and a name regex selected different sets, each of which happened to contain eight tests. --- Wrapping/macro_files/itk_end_wrap_module.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Wrapping/macro_files/itk_end_wrap_module.cmake b/Wrapping/macro_files/itk_end_wrap_module.cmake index bddf23a4d2a..681c7974ea4 100644 --- a/Wrapping/macro_files/itk_end_wrap_module.cmake +++ b/Wrapping/macro_files/itk_end_wrap_module.cmake @@ -646,6 +646,8 @@ ${DO_NOT_WAIT_FOR_THREADS_CALLS} # Add testing set(wrapping_test_directory ${CMAKE_CURRENT_SOURCE_DIR}/test) if(BUILD_TESTING AND EXISTS ${wrapping_test_directory}/CMakeLists.txt) + # itk_add_test labels with ${itk-module}, which is unset in this scope. + set(itk-module ${WRAPPER_LIBRARY_NAME}) add_subdirectory(${wrapping_test_directory}) endif() unset(wrapping_test_directory) From c7c9d43943d836436865e75b7e3cc1b417b7fbee Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Sun, 6 Sep 2026 10:40:59 -0500 Subject: [PATCH 2/2] COMP: Report the resolved Python limited-API setting ITK_USE_PYTHON_LIMITED_API auto-enables from the interpreter version, so not passing it does not mean OFF. Print the value and where it came from. --- CMake/ITKSetPython3Vars.cmake | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CMake/ITKSetPython3Vars.cmake b/CMake/ITKSetPython3Vars.cmake index 520764c2b3a..b000d670a03 100644 --- a/CMake/ITKSetPython3Vars.cmake +++ b/CMake/ITKSetPython3Vars.cmake @@ -111,6 +111,14 @@ else() "SABIModule" _SKBUILD_SABI_COMPONENT_REQUIRED ) + # A reconfigure sees the cached value, so remember how it was first set. + if(NOT DEFINED ITK_USE_PYTHON_LIMITED_API_WAS_AUTO) + if(NOT DEFINED ITK_USE_PYTHON_LIMITED_API) + set(ITK_USE_PYTHON_LIMITED_API_WAS_AUTO 1 CACHE INTERNAL "") + else() + set(ITK_USE_PYTHON_LIMITED_API_WAS_AUTO 0 CACHE INTERNAL "") + endif() + endif() if(NOT DEFINED ITK_USE_PYTHON_LIMITED_API) if( ( @@ -139,7 +147,28 @@ else() endif() mark_as_advanced(ITK_USE_PYTHON_LIMITED_API) endif() + if(ITK_USE_PYTHON_LIMITED_API_WAS_AUTO) + set( + _itk_limited_api_origin + "auto-selected from Python ${ITK_WRAP_PYTHON_VERSION}" + ) + else() + set(_itk_limited_api_origin "requested") + endif() unset(_SKBUILD_SABI_COMPONENT_REQUIRED) + # The value auto-enables by interpreter version, so report what was chosen. + if(ITK_USE_PYTHON_LIMITED_API) + message( + STATUS + "Python wrapping: limited API (abi3) ON [${_itk_limited_api_origin}]" + ) + else() + message( + STATUS + "Python wrapping: limited API (abi3) OFF [${_itk_limited_api_origin}]" + ) + endif() + unset(_itk_limited_api_origin) if(ITK_USE_PYTHON_LIMITED_API) if(CMAKE_VERSION VERSION_LESS "3.26") message(