From 52af0756b2ffc6788e364971d05cdaf127d77d5a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 19 Oct 2021 12:10:22 +0200 Subject: bpo-45434: Only exclude 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. --- Include/Python.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Include/Python.h') 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 // 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 # include // FILE* -#endif -#ifdef HAVE_ERRNO_H # include // errno +# include // memcpy() #endif #ifndef MS_WINDOWS # include -- cgit v1.2.3