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