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.
This commit is contained in:
Victor Stinner 2021-10-19 12:10:22 +02:00 committed by GitHub
parent 0a4c82ddd3
commit 52af0756b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 31 deletions

View file

@ -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>