From 47abf2889e6892a767818c9762b91a2032fe64c7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 5 Oct 2026 16:58:35 +0200 Subject: [PATCH 1/2] gh-149044: Fix PySlot_END macro for C++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initialize all fields in the macro. Otherwise, g++ -Wall -Wextra complains that some fields are not initialized [-Werror=missing-field-initializers]: error: missing initializer for member ‘PySlot::sl_flags’ error: missing initializer for member ‘PySlot::’ error: missing initializer for member ‘PySlot::’ --- Include/slots.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/slots.h b/Include/slots.h index 4bf7bda0208a8df..3ef8768bbd26c3d 100644 --- a/Include/slots.h +++ b/Include/slots.h @@ -42,7 +42,7 @@ struct PySlot { #define PySlot_STATIC_DATA(NAME, VALUE) \ {.sl_id=(NAME), .sl_flags=PySlot_STATIC, .sl_ptr=(VALUE)} -#define PySlot_END {0} +#define PySlot_END {0, 0, {0}, {0}} // Macros without designated initializers (for C++11 and below): From c3671d7e79dcd6aeb6f534e5d9ae9451627cf9d7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 5 Oct 2026 17:09:40 +0200 Subject: [PATCH 2/2] Add Changelog --- .../next/C_API/2026-10-05-17-09-35.gh-issue-149044.1HUiag.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/C_API/2026-10-05-17-09-35.gh-issue-149044.1HUiag.rst diff --git a/Misc/NEWS.d/next/C_API/2026-10-05-17-09-35.gh-issue-149044.1HUiag.rst b/Misc/NEWS.d/next/C_API/2026-10-05-17-09-35.gh-issue-149044.1HUiag.rst new file mode 100644 index 000000000000000..3861d23e27f8b32 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2026-10-05-17-09-35.gh-issue-149044.1HUiag.rst @@ -0,0 +1,2 @@ +Fix the :c:macro:`PySlot_END` macro for C++: initialize all members to avoid +compiler warnings. Patch by Victor Stinner.