summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-11 21:30:00 (GMT)
committerGitHub <noreply@github.com>2021-10-11 21:30:00 (GMT)
commit03ea862b8a8234176761240ba122254e9eb11663 (patch)
tree54558cc38bff4fd02bdd3a3f07d5c41c1bee7351
parent7103356455c8b0c2ba3523929327756413337a31 (diff)
downloadcpython-03ea862b8a8234176761240ba122254e9eb11663.zip
cpython-03ea862b8a8234176761240ba122254e9eb11663.tar.gz
cpython-03ea862b8a8234176761240ba122254e9eb11663.tar.bz2
bpo-45434: Python.h no longer includes <stdlib.h> (GH-28888)
-rw-r--r--Doc/whatsnew/3.11.rst4
-rw-r--r--Include/Python.h1
-rw-r--r--Misc/NEWS.d/next/C API/2021-10-11-23-03-49.bpo-45434.tsS8I_.rst3
3 files changed, 7 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 2262d42..1455a59 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 fa77521..8c84c90 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 0000000..c04dda5
--- /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.