summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Include/Python.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Include/Python.h')
-rw-r--r--contrib/tools/python3/Include/Python.h65
1 files changed, 48 insertions, 17 deletions
diff --git a/contrib/tools/python3/Include/Python.h b/contrib/tools/python3/Include/Python.h
index 5eddda63361..0f75de6cb42 100644
--- a/contrib/tools/python3/Include/Python.h
+++ b/contrib/tools/python3/Include/Python.h
@@ -5,42 +5,71 @@
#ifndef Py_PYTHON_H
#define Py_PYTHON_H
-// Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" {
+// Since this is a "meta-include" file, "#ifdef __cplusplus / extern "C" {"
+// is not needed.
+
// Include Python header files
#include "patchlevel.h"
#include "pyconfig.h"
#include "pymacconfig.h"
-#if defined(__sgi) && !defined(_SGI_MP_SOURCE)
-# define _SGI_MP_SOURCE
+
+// Include standard header files
+// When changing these files, remember to update Doc/extending/extending.rst.
+#include <assert.h> // assert()
+#include <inttypes.h> // uintptr_t
+#include <limits.h> // INT_MAX
+#include <math.h> // HUGE_VAL
+#include <stdarg.h> // va_list
+#include <wchar.h> // wchar_t
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h> // ssize_t
#endif
-// 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.
+// <errno.h>, <stdio.h>, <stdlib.h> and <string.h> headers are no longer used
+// by Python, but kept for the backward compatibility of existing third party C
+// extensions. They are not included by limited C API version 3.11 and newer.
+//
+// The <ctype.h> and <unistd.h> headers are not included by limited C API
+// version 3.13 and newer.
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
-# include <stdlib.h>
-# include <stdio.h> // FILE*
# include <errno.h> // errno
+# include <stdio.h> // FILE*
+# include <stdlib.h> // getenv()
# include <string.h> // memcpy()
#endif
-#ifndef MS_WINDOWS
-# include <unistd.h>
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000
+# include <ctype.h> // tolower()
+# ifndef MS_WINDOWS
+# include <unistd.h> // close()
+# endif
#endif
-#ifdef HAVE_STDDEF_H
-# include <stddef.h> // size_t
+
+// gh-111506: The free-threaded build is not compatible with the limited API
+// or the stable ABI.
+#if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
+# error "The limited API is not currently supported in the free-threaded build"
#endif
-#include <assert.h> // assert()
-#include <wchar.h> // wchar_t
+#if defined(Py_GIL_DISABLED) && defined(_MSC_VER)
+# include <intrin.h> // __readgsqword()
+#endif
+
+#if defined(Py_GIL_DISABLED) && defined(__MINGW32__)
+# include <intrin.h> // __readgsqword()
+#endif
+// Include Python header files
#include "pyport.h"
#include "pymacro.h"
#include "pymath.h"
#include "pymem.h"
#include "pytypedefs.h"
#include "pybuffer.h"
+#include "pystats.h"
+#include "pyatomic.h"
+#include "lock.h"
#include "object.h"
#include "objimpl.h"
#include "typeslots.h"
@@ -49,8 +78,6 @@
#include "bytearrayobject.h"
#include "bytesobject.h"
#include "unicodeobject.h"
-#include "cpython/initconfig.h"
-#include "pystate.h"
#include "pyerrors.h"
#include "longobject.h"
#include "cpython/longintrepr.h"
@@ -67,6 +94,7 @@
#include "setobject.h"
#include "methodobject.h"
#include "moduleobject.h"
+#include "monitoring.h"
#include "cpython/funcobject.h"
#include "cpython/classobject.h"
#include "fileobject.h"
@@ -77,6 +105,8 @@
#include "sliceobject.h"
#include "cpython/cellobject.h"
#include "iterobject.h"
+#include "cpython/initconfig.h"
+#include "pystate.h"
#include "cpython/genobject.h"
#include "descrobject.h"
#include "genericaliasobject.h"
@@ -99,11 +129,12 @@
#include "import.h"
#include "abstract.h"
#include "bltinmodule.h"
+#include "critical_section.h"
#include "cpython/pyctype.h"
#include "pystrtod.h"
#include "pystrcmp.h"
#include "fileutils.h"
#include "cpython/pyfpe.h"
-#include "tracemalloc.h"
+#include "cpython/tracemalloc.h"
#endif /* !Py_PYTHON_H */