• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Entry point of the Python C API.
2 // C extensions should only #include <Python.h>, and not include directly
3 // the other Python header files included by <Python.h>.
4 
5 #ifndef Py_PYTHON_H
6 #define Py_PYTHON_H
7 
8 // Since this is a "meta-include" file, "#ifdef __cplusplus / extern "C" {"
9 // is not needed.
10 
11 
12 // Include Python header files
13 #include "patchlevel.h"
14 #include "pyconfig.h"
15 #include "pymacconfig.h"
16 
17 
18 // Include standard header files
19 #include <assert.h>               // assert()
20 #include <inttypes.h>             // uintptr_t
21 #include <limits.h>               // INT_MAX
22 #include <math.h>                 // HUGE_VAL
23 #include <stdarg.h>               // va_list
24 #include <wchar.h>                // wchar_t
25 #ifdef HAVE_SYS_TYPES_H
26 #  include <sys/types.h>          // ssize_t
27 #endif
28 
29 // <errno.h>, <stdio.h>, <stdlib.h> and <string.h> headers are no longer used
30 // by Python, but kept for the backward compatibility of existing third party C
31 // extensions. They are not included by limited C API version 3.11 and newer.
32 //
33 // The <ctype.h> and <unistd.h> headers are not included by limited C API
34 // version 3.13 and newer.
35 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
36 #  include <errno.h>              // errno
37 #  include <stdio.h>              // FILE*
38 #  include <stdlib.h>             // getenv()
39 #  include <string.h>             // memcpy()
40 #endif
41 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000
42 #  include <ctype.h>              // tolower()
43 #  ifndef MS_WINDOWS
44 #    include <unistd.h>           // close()
45 #  endif
46 #endif
47 
48 // gh-111506: The free-threaded build is not compatible with the limited API
49 // or the stable ABI.
50 #if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
51 #  error "The limited API is not currently supported in the free-threaded build"
52 #endif
53 
54 #if defined(Py_GIL_DISABLED) && defined(_MSC_VER)
55 #  include <intrin.h>             // __readgsqword()
56 #endif
57 
58 #if defined(Py_GIL_DISABLED) && defined(__MINGW32__)
59 #  include <intrin.h>             // __readgsqword()
60 #endif
61 
62 // Include Python header files
63 #include "pyport.h"
64 #include "pymacro.h"
65 #include "pymath.h"
66 #include "pymem.h"
67 #include "pytypedefs.h"
68 #include "pybuffer.h"
69 #include "pystats.h"
70 #include "pyatomic.h"
71 #include "lock.h"
72 #include "object.h"
73 #include "objimpl.h"
74 #include "typeslots.h"
75 #include "pyhash.h"
76 #include "cpython/pydebug.h"
77 #include "bytearrayobject.h"
78 #include "bytesobject.h"
79 #include "unicodeobject.h"
80 #include "pyerrors.h"
81 #include "longobject.h"
82 #include "cpython/longintrepr.h"
83 #include "boolobject.h"
84 #include "floatobject.h"
85 #include "complexobject.h"
86 #include "rangeobject.h"
87 #include "memoryobject.h"
88 #include "tupleobject.h"
89 #include "listobject.h"
90 #include "dictobject.h"
91 #include "cpython/odictobject.h"
92 #include "enumobject.h"
93 #include "setobject.h"
94 #include "methodobject.h"
95 #include "moduleobject.h"
96 #include "monitoring.h"
97 #include "cpython/funcobject.h"
98 #include "cpython/classobject.h"
99 #include "fileobject.h"
100 #include "pycapsule.h"
101 #include "cpython/code.h"
102 #include "pyframe.h"
103 #include "traceback.h"
104 #include "sliceobject.h"
105 #include "cpython/cellobject.h"
106 #include "iterobject.h"
107 #include "cpython/initconfig.h"
108 #include "pystate.h"
109 #include "cpython/genobject.h"
110 #include "descrobject.h"
111 #include "genericaliasobject.h"
112 #include "warnings.h"
113 #include "weakrefobject.h"
114 #include "structseq.h"
115 #include "cpython/picklebufobject.h"
116 #include "cpython/pytime.h"
117 #include "codecs.h"
118 #include "pythread.h"
119 #include "cpython/context.h"
120 #include "modsupport.h"
121 #include "compile.h"
122 #include "pythonrun.h"
123 #include "pylifecycle.h"
124 #include "ceval.h"
125 #include "sysmodule.h"
126 #include "osmodule.h"
127 #include "intrcheck.h"
128 #include "import.h"
129 #include "abstract.h"
130 #include "bltinmodule.h"
131 #include "critical_section.h"
132 #include "cpython/pyctype.h"
133 #include "pystrtod.h"
134 #include "pystrcmp.h"
135 #include "fileutils.h"
136 #include "cpython/pyfpe.h"
137 #include "cpython/tracemalloc.h"
138 
139 #endif /* !Py_PYTHON_H */
140