From c2e0043a097b87d54345ab6fbf4a15c095e4533e Mon Sep 17 00:00:00 2001 From: "A. Rager" Date: Mon, 6 Apr 2026 15:17:59 -0700 Subject: [PATCH 1/2] ignore maybe-initialized warning in convert_elements --- include/pybind11/stl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index 01be0b47c6..11b546c269 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -326,6 +326,10 @@ struct list_caster { bool convert_elements(handle seq, bool convert) { auto s = reinterpret_borrow(seq); +PYBIND11_WARNING_PUSH +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 13 +PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") +#endif value.clear(); reserve_maybe(s, &value); for (const auto &it : seq) { @@ -335,6 +339,7 @@ struct list_caster { } value.push_back(cast_op(std::move(conv))); } +PYBIND11_WARNING_POP return true; } From 2c0553131c78434d4f76b860eb49217a9b8dde9b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 22:33:34 +0000 Subject: [PATCH 2/2] style: pre-commit fixes --- include/pybind11/stl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index 11b546c269..414f243ece 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -326,9 +326,9 @@ struct list_caster { bool convert_elements(handle seq, bool convert) { auto s = reinterpret_borrow(seq); -PYBIND11_WARNING_PUSH + PYBIND11_WARNING_PUSH #if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 13 -PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") + PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") #endif value.clear(); reserve_maybe(s, &value); @@ -339,7 +339,7 @@ PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") } value.push_back(cast_op(std::move(conv))); } -PYBIND11_WARNING_POP + PYBIND11_WARNING_POP return true; }