diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index 01be0b47c6..414f243ece 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; }