Skip to content

Commit

Permalink
rootstate.c: Fix -Wmissing-braces compile warning
Browse files Browse the repository at this point in the history
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] python/cpython@ea2c001
  • Loading branch information
zhuyifei1999 committed Dec 12, 2024
1 parent ed63cb8 commit b9c4bc6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/heapy/rootstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,5 +806,6 @@ PyTypeObject NyRootState_Type = {

PyObject _Ny_RootStateStruct = {
_PyObject_EXTRA_INIT
1, &NyRootState_Type
.ob_refcnt = 1,
.ob_type = &NyRootState_Type,
};

0 comments on commit b9c4bc6

Please sign in to comment.