From 9b2f967bc04d1265b6796ed9e45e95a8412309eb Mon Sep 17 00:00:00 2001 From: mborgerding Date: Mon, 24 Aug 2026 08:53:27 -0400 Subject: [PATCH 1/3] avoid undefined behavior: calling `front()` on a possibly empty `std::vector` crashes systems that use debug checks. See github issue #526 https://github.com/boostorg/python/issues/526 --- src/numpy/ndarray.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/numpy/ndarray.cpp b/src/numpy/ndarray.cpp index af09ecc338..9217753932 100644 --- a/src/numpy/ndarray.cpp +++ b/src/numpy/ndarray.cpp @@ -127,8 +127,8 @@ ndarray from_data_impl(void * data, (PyArray_NewFromDescr(&PyArray_Type, incref_dtype(dt), shape.size(), - const_cast(&shape.front()), - const_cast(&strides.front()), + const_cast(shape.data()), + const_cast(strides.data()), data, flags, NULL))); From 1c267729c742bb52457796ee20756992e886a8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Garc=C3=ADa?= Date: Tue, 1 Sep 2026 19:18:42 +0000 Subject: [PATCH 2/3] Fixing N leakage --- include/boost/python/detail/caller.hpp | 2 +- include/boost/python/detail/signature.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/python/detail/caller.hpp b/include/boost/python/detail/caller.hpp index 2834d6da99..898be38326 100644 --- a/include/boost/python/detail/caller.hpp +++ b/include/boost/python/detail/caller.hpp @@ -263,7 +263,7 @@ struct caller_arity }; }; - +# undef N #endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/python/detail/signature.hpp b/include/boost/python/detail/signature.hpp index 11268b92cf..214b414647 100644 --- a/include/boost/python/detail/signature.hpp +++ b/include/boost/python/detail/signature.hpp @@ -101,6 +101,8 @@ struct signature_arity }; }; +# undef N + #endif // BOOST_PP_IS_ITERATING From 2ec14c45a4628e2c6353cff1febc41f7c2d882fe Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Sat, 3 Oct 2026 12:01:09 +0300 Subject: [PATCH 3/3] Enable BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE for the LCC compiler LCC is based on EDG, but it does have `gcc_demangle`. --- include/boost/python/type_id.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/python/type_id.hpp b/include/boost/python/type_id.hpp index 601601c311..849b77c2ee 100644 --- a/include/boost/python/type_id.hpp +++ b/include/boost/python/type_id.hpp @@ -18,7 +18,7 @@ # ifndef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE # if defined(__GNUC__) \ - && !defined(__EDG_VERSION__) + && (!defined(__EDG_VERSION__) || defined(__LCC__)) # define BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE # endif # endif