|
9 | 9 | // is not needed. |
10 | 10 |
|
11 | 11 |
|
12 | | -// Include Python header files |
13 | | -#include "patchlevel.h" |
14 | | -#include "pyconfig.h" |
15 | | -#include "pymacconfig.h" |
| 12 | +// Include Python configuration headers |
| 13 | +#include "patchlevel.h" // the Python version |
| 14 | +#include "pyconfig.h" // information from configure |
| 15 | +#include "pymacconfig.h" // overrides for pyconfig |
| 16 | +#include "pyabi.h" // feature/ABI selection |
16 | 17 |
|
17 | 18 |
|
18 | 19 | // Include standard header files |
|
22 | 23 | #include <limits.h> // INT_MAX |
23 | 24 | #include <math.h> // HUGE_VAL |
24 | 25 | #include <stdarg.h> // va_list |
| 26 | +#include <string.h> // memcpy() |
25 | 27 | #include <wchar.h> // wchar_t |
26 | 28 | #ifdef HAVE_SYS_TYPES_H |
27 | 29 | # include <sys/types.h> // ssize_t |
28 | 30 | #endif |
29 | 31 |
|
30 | | -// <errno.h>, <stdio.h>, <stdlib.h> and <string.h> headers are no longer used |
| 32 | +// <errno.h>, <stdio.h> and <stdlib.h> headers are no longer used |
31 | 33 | // by Python, but kept for the backward compatibility of existing third party C |
32 | 34 | // extensions. They are not included by limited C API version 3.11 and newer. |
33 | 35 | // |
|
37 | 39 | # include <errno.h> // errno |
38 | 40 | # include <stdio.h> // FILE* |
39 | 41 | # include <stdlib.h> // getenv() |
40 | | -# include <string.h> // memcpy() |
41 | 42 | #endif |
42 | 43 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000 |
43 | 44 | # include <ctype.h> // tolower() |
|
46 | 47 | # endif |
47 | 48 | #endif |
48 | 49 |
|
49 | | -// gh-111506: The free-threaded build is not compatible with the limited API |
50 | | -// or the stable ABI. |
51 | | -#if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) |
52 | | -# error "The limited API is not currently supported in the free-threaded build" |
53 | | -#endif |
54 | | - |
55 | | -#if defined(Py_GIL_DISABLED) && defined(_MSC_VER) |
56 | | -# include <intrin.h> // __readgsqword() |
57 | | -#endif |
| 50 | +#if !defined(Py_LIMITED_API) |
| 51 | +# if defined(Py_GIL_DISABLED) |
| 52 | +# if defined(_MSC_VER) || defined(__MINGW32__) |
| 53 | +# include <intrin.h> // __readgsqword() |
| 54 | +# endif |
| 55 | +# endif |
| 56 | +#endif // Py_GIL_DISABLED |
58 | 57 |
|
59 | | -#if defined(Py_GIL_DISABLED) && defined(__MINGW32__) |
60 | | -# include <intrin.h> // __readgsqword() |
| 58 | +#ifdef _MSC_VER |
| 59 | +// Ignore MSC warning C4201: "nonstandard extension used: nameless |
| 60 | +// struct/union". (Only generated for C standard versions less than C11, which |
| 61 | +// we don't *officially* support.) |
| 62 | +__pragma(warning(push)) |
| 63 | +__pragma(warning(disable: 4201)) |
61 | 64 | #endif |
62 | 65 |
|
63 | | -// Suppress known warnings in Python header files. |
64 | | -#if defined(_MSC_VER) |
65 | | -// Warning that alignas behaviour has changed. Doesn't affect us, because we |
66 | | -// never relied on the old behaviour. |
67 | | -#pragma warning(push) |
68 | | -#pragma warning(disable: 5274) |
69 | | -#endif |
70 | 66 |
|
71 | 67 | // Include Python header files |
72 | 68 | #include "pyport.h" |
| 69 | +#include "exports.h" |
73 | 70 | #include "pymacro.h" |
74 | 71 | #include "pymath.h" |
75 | 72 | #include "pymem.h" |
76 | 73 | #include "pytypedefs.h" |
77 | 74 | #include "pybuffer.h" |
78 | 75 | #include "pystats.h" |
79 | 76 | #include "pyatomic.h" |
80 | | -#include "lock.h" |
| 77 | +#include "cpython/pylock.h" |
81 | 78 | #include "critical_section.h" |
82 | 79 | #include "object.h" |
83 | 80 | #include "refcount.h" |
84 | 81 | #include "objimpl.h" |
85 | | -#include "typeslots.h" |
| 82 | +#include "slots.h" |
| 83 | +#include "slots_generated.h" |
86 | 84 | #include "pyhash.h" |
87 | 85 | #include "cpython/pydebug.h" |
88 | 86 | #include "bytearrayobject.h" |
|
104 | 102 | #include "setobject.h" |
105 | 103 | #include "methodobject.h" |
106 | 104 | #include "moduleobject.h" |
107 | | -#include "monitoring.h" |
| 105 | +#include "cpython/monitoring.h" |
108 | 106 | #include "cpython/funcobject.h" |
109 | 107 | #include "cpython/classobject.h" |
110 | 108 | #include "fileobject.h" |
|
120 | 118 | #include "cpython/genobject.h" |
121 | 119 | #include "descrobject.h" |
122 | 120 | #include "genericaliasobject.h" |
| 121 | +#include "cpython/sentinelobject.h" |
123 | 122 | #include "warnings.h" |
124 | 123 | #include "weakrefobject.h" |
125 | 124 | #include "structseq.h" |
|
147 | 146 | #include "cpython/pyfpe.h" |
148 | 147 | #include "cpython/tracemalloc.h" |
149 | 148 |
|
150 | | -// Restore warning filter |
151 | 149 | #ifdef _MSC_VER |
152 | | -#pragma warning(pop) |
| 150 | +__pragma(warning(pop)) // warning(disable: 4201) |
153 | 151 | #endif |
154 | 152 |
|
155 | 153 | #endif /* !Py_PYTHON_H */ |
0 commit comments