From 3f6d6f41e0d7a8ffd8969a1d63d636ed0ee17d56 Mon Sep 17 00:00:00 2001 From: mborgerding Date: Mon, 24 Aug 2026 08:53:27 -0400 Subject: [PATCH] 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)));