|
| 1 | +#ifndef Py_PYTHON_H |
| 2 | +#define Py_PYTHON_H |
| 3 | +/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ |
| 4 | + |
| 5 | +/* Include nearly all Python header files */ |
| 6 | + |
| 7 | +#include "patchlevel.h" |
| 8 | +#include "pyconfig.h" |
| 9 | +#include "pymacconfig.h" |
| 10 | + |
| 11 | +/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the |
| 12 | + * old symbol for the benefit of extension modules written before then |
| 13 | + * that may be conditionalizing on it. The core doesn't use it anymore. |
| 14 | + */ |
| 15 | +#ifndef WITH_CYCLE_GC |
| 16 | +#define WITH_CYCLE_GC 1 |
| 17 | +#endif |
| 18 | + |
| 19 | +#include <limits.h> |
| 20 | + |
| 21 | +#ifndef UCHAR_MAX |
| 22 | +#error "Something's broken. UCHAR_MAX should be defined in limits.h." |
| 23 | +#endif |
| 24 | + |
| 25 | +#if UCHAR_MAX != 255 |
| 26 | +#error "Python's source code assumes C's unsigned char is an 8-bit type." |
| 27 | +#endif |
| 28 | + |
| 29 | +#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) |
| 30 | +#define _SGI_MP_SOURCE |
| 31 | +#endif |
| 32 | + |
| 33 | +#include <stdio.h> |
| 34 | +#ifndef NULL |
| 35 | +# error "Python.h requires that stdio.h define NULL." |
| 36 | +#endif |
| 37 | + |
| 38 | +#include <string.h> |
| 39 | +#ifdef HAVE_ERRNO_H |
| 40 | +#include <errno.h> |
| 41 | +#endif |
| 42 | +#include <stdlib.h> |
| 43 | +#ifdef HAVE_UNISTD_H |
| 44 | +#include <unistd.h> |
| 45 | +#endif |
| 46 | + |
| 47 | +/* For size_t? */ |
| 48 | +#ifdef HAVE_STDDEF_H |
| 49 | +#include <stddef.h> |
| 50 | +#endif |
| 51 | + |
| 52 | +/* CAUTION: Build setups should ensure that NDEBUG is defined on the |
| 53 | + * compiler command line when building Python in release mode; else |
| 54 | + * assert() calls won't be removed. |
| 55 | + */ |
| 56 | +#include <assert.h> |
| 57 | + |
| 58 | +#include "pyport.h" |
| 59 | + |
| 60 | +/* pyconfig.h or pyport.h may or may not define DL_IMPORT */ |
| 61 | +#ifndef DL_IMPORT /* declarations for DLL import/export */ |
| 62 | +#define DL_IMPORT(RTYPE) RTYPE |
| 63 | +#endif |
| 64 | +#ifndef DL_EXPORT /* declarations for DLL import/export */ |
| 65 | +#define DL_EXPORT(RTYPE) RTYPE |
| 66 | +#endif |
| 67 | + |
| 68 | +/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. |
| 69 | + * PYMALLOC_DEBUG is in error if pymalloc is not in use. |
| 70 | + */ |
| 71 | +#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) |
| 72 | +#define PYMALLOC_DEBUG |
| 73 | +#endif |
| 74 | +#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) |
| 75 | +#error "PYMALLOC_DEBUG requires WITH_PYMALLOC" |
| 76 | +#endif |
| 77 | +#include "pymath.h" |
| 78 | +#include "pymem.h" |
| 79 | + |
| 80 | +#include "object.h" |
| 81 | +#include "objimpl.h" |
| 82 | + |
| 83 | +#include "pydebug.h" |
| 84 | + |
| 85 | +#include "unicodeobject.h" |
| 86 | +#include "intobject.h" |
| 87 | +#include "boolobject.h" |
| 88 | +#include "longobject.h" |
| 89 | +#include "floatobject.h" |
| 90 | +#ifndef WITHOUT_COMPLEX |
| 91 | +#include "complexobject.h" |
| 92 | +#endif |
| 93 | +#include "rangeobject.h" |
| 94 | +#include "stringobject.h" |
| 95 | +#include "memoryobject.h" |
| 96 | +#include "bufferobject.h" |
| 97 | +#include "bytesobject.h" |
| 98 | +#include "bytearrayobject.h" |
| 99 | +#include "tupleobject.h" |
| 100 | +#include "listobject.h" |
| 101 | +#include "dictobject.h" |
| 102 | +#include "enumobject.h" |
| 103 | +#include "setobject.h" |
| 104 | +#include "methodobject.h" |
| 105 | +#include "moduleobject.h" |
| 106 | +#include "funcobject.h" |
| 107 | +#include "classobject.h" |
| 108 | +#include "fileobject.h" |
| 109 | +#include "cobject.h" |
| 110 | +#include "pycapsule.h" |
| 111 | +#include "traceback.h" |
| 112 | +#include "sliceobject.h" |
| 113 | +#include "cellobject.h" |
| 114 | +#include "iterobject.h" |
| 115 | +#include "genobject.h" |
| 116 | +#include "descrobject.h" |
| 117 | +#include "warnings.h" |
| 118 | +#include "weakrefobject.h" |
| 119 | + |
| 120 | +#include "codecs.h" |
| 121 | +#include "pyerrors.h" |
| 122 | + |
| 123 | +#include "pystate.h" |
| 124 | + |
| 125 | +#include "pyarena.h" |
| 126 | +#include "modsupport.h" |
| 127 | +#include "pythonrun.h" |
| 128 | +#include "ceval.h" |
| 129 | +#include "sysmodule.h" |
| 130 | +#include "intrcheck.h" |
| 131 | +#include "import.h" |
| 132 | + |
| 133 | +#include "abstract.h" |
| 134 | + |
| 135 | +#include "compile.h" |
| 136 | +#include "eval.h" |
| 137 | + |
| 138 | +#include "pyctype.h" |
| 139 | +#include "pystrtod.h" |
| 140 | +#include "pystrcmp.h" |
| 141 | +#include "dtoa.h" |
| 142 | + |
| 143 | +/* _Py_Mangle is defined in compile.c */ |
| 144 | +PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); |
| 145 | + |
| 146 | +/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ |
| 147 | +#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) |
| 148 | + |
| 149 | +/* PyArg_NoArgs should not be necessary. |
| 150 | + Set ml_flags in the PyMethodDef to METH_NOARGS. */ |
| 151 | +#define PyArg_NoArgs(v) PyArg_Parse(v, "") |
| 152 | + |
| 153 | +/* Argument must be a char or an int in [-128, 127] or [0, 255]. */ |
| 154 | +#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) |
| 155 | + |
| 156 | +#include "pyfpe.h" |
| 157 | + |
| 158 | +/* These definitions must match corresponding definitions in graminit.h. |
| 159 | + There's code in compile.c that checks that they are the same. */ |
| 160 | +#define Py_single_input 256 |
| 161 | +#define Py_file_input 257 |
| 162 | +#define Py_eval_input 258 |
| 163 | + |
| 164 | +#ifdef HAVE_PTH |
| 165 | +/* GNU pth user-space thread support */ |
| 166 | +#include <pth.h> |
| 167 | +#endif |
| 168 | + |
| 169 | +/* Define macros for inline documentation. */ |
| 170 | +#define PyDoc_VAR(name) static char name[] |
| 171 | +#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) |
| 172 | +#ifdef WITH_DOC_STRINGS |
| 173 | +#define PyDoc_STR(str) str |
| 174 | +#else |
| 175 | +#define PyDoc_STR(str) "" |
| 176 | +#endif |
| 177 | + |
| 178 | +#endif /* !Py_PYTHON_H */ |
0 commit comments