https://github.com/python/cpython/commit/727b56b4db5734864953a6586ea03633ef27bad5
commit: 727b56b4db5734864953a6586ea03633ef27bad5
branch: main
author: Neko Asakura <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-13T17:27:18+01:00
summary:

gh-160436: Skip `PyStatus.exitcode` deprecation on clang++ 21 and older 
(#161341)

files:
A Misc/NEWS.d/next/C_API/2026-11-04-14-24-36.gh-issue-160436.WmZEYT.rst
M Include/cpython/initconfig.h

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.

_______________________________________________
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