diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h index 846e05fb26a4d83..e1bdc6174d9de06 100644 --- a/Include/cpython/initconfig.h +++ b/Include/cpython/initconfig.h @@ -15,7 +15,12 @@ typedef struct { } _type; const char *func; const char *err_msg; +#if defined(__cplusplus) && defined(__clang__) && __clang_major__ < 22 + // gh-160436: clang < 22 warns in the implicit copy/move members + int exitcode; +#else Py_DEPRECATED(3.16) int exitcode; +#endif } PyStatus; PyAPI_FUNC(PyStatus) PyStatus_Ok(void); diff --git a/Misc/NEWS.d/next/C_API/2026-11-04-14-24-36.gh-issue-160436.WmZEYT.rst b/Misc/NEWS.d/next/C_API/2026-11-04-14-24-36.gh-issue-160436.WmZEYT.rst new file mode 100644 index 000000000000000..4cef63faaa4cdf2 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2026-11-04-14-24-36.gh-issue-160436.WmZEYT.rst @@ -0,0 +1,4 @@ +Fix a spurious ``-Wdeprecated-declarations`` warning when a +:c:type:`PyStatus` is copied in C++ with clang 21 and older: +:c:member:`PyStatus.exitcode` is no longer marked as deprecated for C++ on +those compilers.