https://github.com/python/cpython/commit/45247863004be2d28c9208fb86dfd67e72522083
commit: 45247863004be2d28c9208fb86dfd67e72522083
branch: 3.14
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-10-26T01:17:51+01:00
summary:

[3.14] gh-160208: Fix PyObject structure on C++ (#160562)

On C++, use __extension__ on the anonymous union even if the __STDC_VERSION__
macro is defined to C11 or newer (which is the case on OpenIndiana).

files:
M Include/object.h

diff --git a/Include/object.h b/Include/object.h
index a67a4cdb3c138b2..e6fd16c3670a36a 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -109,7 +109,8 @@ whose size is determined when the object is allocated.
 #ifndef Py_GIL_DISABLED
 struct _object {
 #if (defined(__GNUC__) || defined(__clang__)) \
-        && !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)
+        && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L \
+            || defined(__cplusplus))
     // On C99 and older, anonymous union is a GCC and clang extension
     __extension__
 #endif

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to