From b9c4bc6ca34da28854afacdb697e18e56c808cea Mon Sep 17 00:00:00 2001 From: YiFei Zhu Date: Wed, 11 Dec 2024 16:14:49 -0800 Subject: [PATCH] rootstate.c: Fix -Wmissing-braces compile warning In Python 3.12 [1], ob_refcnt became part of an anonymous union along with ob_refcnt_split, which is conditionally compiled in. Instead of adding braces and implicitly assigning the former ob_refcnt to the new field inside the union, just use a designated initializer, just like how cpython itself does it with _PyObject_HEAD_INIT. [1] https://github.com/python/cpython/commit/ea2c0016502472aa8baa3149050ada776d17a009 --- src/heapy/rootstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/heapy/rootstate.c b/src/heapy/rootstate.c index 3e606be..f6e3f11 100644 --- a/src/heapy/rootstate.c +++ b/src/heapy/rootstate.c @@ -806,5 +806,6 @@ PyTypeObject NyRootState_Type = { PyObject _Ny_RootStateStruct = { _PyObject_EXTRA_INIT - 1, &NyRootState_Type + .ob_refcnt = 1, + .ob_type = &NyRootState_Type, };