aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Include/Python.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-19 12:10:22 +0200
committerGitHub <noreply@github.com>2021-10-19 12:10:22 +0200
commit52af0756b2ffc6788e364971d05cdaf127d77d5a (patch)
tree8a2175ea934e639eac93bf33b5a22efde8979e9c /Include/Python.h
parent0a4c82ddd34a3578684b45b76f49cd289a08740b (diff)
downloadcpython-52af0756b2ffc6788e364971d05cdaf127d77d5a.tar.gz
cpython-52af0756b2ffc6788e364971d05cdaf127d77d5a.zip
bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)
The Python 3.11 limited C API no longer includes stdlib.h, stdio.h, string.h and errno.h. * Exclude Py_MEMCPY() from Python 3.11 limited C API. * xxlimited C extension is now built with Python 3.11 limited C API.
Diffstat (limited to 'Include/Python.h')
-rw-r--r--Include/Python.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Include/Python.h b/Include/Python.h
index c0a621ad44a..6e3303ac9a3 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -16,12 +16,14 @@
# define _SGI_MP_SOURCE
#endif
-#include <string.h> // memcpy()
-#ifndef Py_LIMITED_API
+// stdlib.h, stdio.h, errno.h and string.h headers are not used by Python
+// headers, but kept for backward compatibility. They are excluded from the
+// limited C API of Python 3.11.
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
+# include <stdlib.h>
# include <stdio.h> // FILE*
-#endif
-#ifdef HAVE_ERRNO_H
# include <errno.h> // errno
+# include <string.h> // memcpy()
#endif
#ifndef MS_WINDOWS
# include <unistd.h>