[Python-checkins] bpo-45434: Python.h no longer includes <stdlib.h> (GH-28888)
vstinner
webhook-mailer at python.org
Mon Oct 11 17:30:10 EDT 2021
https://github.com/python/cpython/commit/03ea862b8a8234176761240ba122254e9eb11663
commit: 03ea862b8a8234176761240ba122254e9eb11663
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-10-11T23:30:00+02:00
summary:
bpo-45434: Python.h no longer includes <stdlib.h> (GH-28888)
files:
A Misc/NEWS.d/next/C API/2021-10-11-23-03-49.bpo-45434.tsS8I_.rst
M Doc/whatsnew/3.11.rst
M Include/Python.h
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 2262d42a99add..1455a598e1b3c 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -552,6 +552,10 @@ Porting to Python 3.11
(Contributed by Victor Stinner in :issue:`39573`.)
+* The ``<Python.h>`` header file no longer includes ``<stdlib.h>``. C
+ extensions using ``<stdlib.h>`` must now include it explicitly.
+ (Contributed by Victor Stinner in :issue:`45434`.)
+
Deprecated
----------
diff --git a/Include/Python.h b/Include/Python.h
index fa77521d46ebb..8c84c90f9a57e 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -25,7 +25,6 @@
#ifdef HAVE_ERRNO_H
# include <errno.h> // errno
#endif
-#include <stdlib.h>
#ifndef MS_WINDOWS
# include <unistd.h>
#endif
diff --git a/Misc/NEWS.d/next/C API/2021-10-11-23-03-49.bpo-45434.tsS8I_.rst b/Misc/NEWS.d/next/C API/2021-10-11-23-03-49.bpo-45434.tsS8I_.rst
new file mode 100644
index 0000000000000..c04dda532557d
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2021-10-11-23-03-49.bpo-45434.tsS8I_.rst
@@ -0,0 +1,3 @@
+The ``<Python.h>`` header file no longer includes ``<stdlib.h>``. C
+extensions using ``<stdlib.h>`` must now include it explicitly. Patch by
+Victor Stinner.
More information about the Python-checkins
mailing list