From bce46f28de392862d5c6c3b185d844ee7c623be3 Mon Sep 17 00:00:00 2001 From: shadchin Date: Tue, 3 Feb 2026 21:59:07 +0300 Subject: Import Python 3.13.11 commit_hash:bbb53cefb159aa3e7afaa475fd19d5a03b66945f --- contrib/tools/python3/Include/Python.h | 65 +++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 17 deletions(-) (limited to 'contrib/tools/python3/Include/Python.h') 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() +#include // uintptr_t +#include // INT_MAX +#include // HUGE_VAL +#include // va_list +#include // wchar_t +#ifdef HAVE_SYS_TYPES_H +# include // 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. +// , , and 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 and headers are not included by limited C API +// version 3.13 and newer. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 -# include -# include // FILE* # include // errno +# include // FILE* +# include // getenv() # include // memcpy() #endif -#ifndef MS_WINDOWS -# include +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000 +# include // tolower() +# ifndef MS_WINDOWS +# include // close() +# endif #endif -#ifdef HAVE_STDDEF_H -# include // 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() -#include // wchar_t +#if defined(Py_GIL_DISABLED) && defined(_MSC_VER) +# include // __readgsqword() +#endif + +#if defined(Py_GIL_DISABLED) && defined(__MINGW32__) +# include // __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 */ -- cgit v1.3