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 #ifdef HAVE_CRYPT_H 47 #include <crypt.h> 48 #endif 49 50 /* For size_t? */ 51 #ifdef HAVE_STDDEF_H 52 #include <stddef.h> 53 #endif 54 55 /* CAUTION: Build setups should ensure that NDEBUG is defined on the 56 * compiler command line when building Python in release mode; else 57 * assert() calls won't be removed. 58 */ 59 #include <assert.h> 60 61 #include "pyport.h" 62 63 /* pyconfig.h or pyport.h may or may not define DL_IMPORT */ 64 #ifndef DL_IMPORT /* declarations for DLL import/export */ 65 #define DL_IMPORT(RTYPE) RTYPE 66 #endif 67 #ifndef DL_EXPORT /* declarations for DLL import/export */ 68 #define DL_EXPORT(RTYPE) RTYPE 69 #endif 70 71 /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. 72 * PYMALLOC_DEBUG is in error if pymalloc is not in use. 73 */ 74 #if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) 75 #define PYMALLOC_DEBUG 76 #endif 77 #if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) 78 #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" 79 #endif 80 #include "pymath.h" 81 #include "pymem.h" 82 83 #include "object.h" 84 #include "objimpl.h" 85 86 #include "pydebug.h" 87 88 #include "unicodeobject.h" 89 #include "intobject.h" 90 #include "boolobject.h" 91 #include "longobject.h" 92 #include "floatobject.h" 93 #ifndef WITHOUT_COMPLEX 94 #include "complexobject.h" 95 #endif 96 #include "rangeobject.h" 97 #include "stringobject.h" 98 #include "memoryobject.h" 99 #include "bufferobject.h" 100 #include "bytesobject.h" 101 #include "bytearrayobject.h" 102 #include "tupleobject.h" 103 #include "listobject.h" 104 #include "dictobject.h" 105 #include "enumobject.h" 106 #include "setobject.h" 107 #include "methodobject.h" 108 #include "moduleobject.h" 109 #include "funcobject.h" 110 #include "classobject.h" 111 #include "fileobject.h" 112 #include "cobject.h" 113 #include "pycapsule.h" 114 #include "traceback.h" 115 #include "sliceobject.h" 116 #include "cellobject.h" 117 #include "iterobject.h" 118 #include "genobject.h" 119 #include "descrobject.h" 120 #include "warnings.h" 121 #include "weakrefobject.h" 122 123 #include "codecs.h" 124 #include "pyerrors.h" 125 126 #include "pystate.h" 127 128 #include "pyarena.h" 129 #include "modsupport.h" 130 #include "pythonrun.h" 131 #include "ceval.h" 132 #include "sysmodule.h" 133 #include "intrcheck.h" 134 #include "import.h" 135 136 #include "abstract.h" 137 138 #include "compile.h" 139 #include "eval.h" 140 141 #include "pyctype.h" 142 #include "pystrtod.h" 143 #include "pystrcmp.h" 144 #include "dtoa.h" 145 146 /* _Py_Mangle is defined in compile.c */ 147 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); 148 149 /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ 150 #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) 151 152 /* PyArg_NoArgs should not be necessary. 153 Set ml_flags in the PyMethodDef to METH_NOARGS. */ 154 #define PyArg_NoArgs(v) PyArg_Parse(v, "") 155 156 /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ 157 #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) 158 159 #include "pyfpe.h" 160 161 /* These definitions must match corresponding definitions in graminit.h. 162 There's code in compile.c that checks that they are the same. */ 163 #define Py_single_input 256 164 #define Py_file_input 257 165 #define Py_eval_input 258 166 167 #ifdef HAVE_PTH 168 /* GNU pth user-space thread support */ 169 #include <pth.h> 170 #endif 171 172 /* Define macros for inline documentation. */ 173 #define PyDoc_VAR(name) static char name[] 174 #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) 175 #ifdef WITH_DOC_STRINGS 176 #define PyDoc_STR(str) str 177 #else 178 #define PyDoc_STR(str) "" 179 #endif 180 181 #endif /* !Py_PYTHON_H */ 182