Python.h revision 737ea82a5abd448b3e214b44d7d3c579b77e8155
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
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.
13 */
14#ifndef WITH_CYCLE_GC
15#define WITH_CYCLE_GC 1
16#endif
17
18#include <limits.h>
19
20#ifndef UCHAR_MAX
21#error "Something's broken.  UCHAR_MAX should be defined in limits.h."
22#endif
23
24#if UCHAR_MAX != 255
25#error "Python's source code assumes C's unsigned char is an 8-bit type."
26#endif
27
28#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
29#define _SGI_MP_SOURCE
30#endif
31
32#include <stdio.h>
33#ifndef NULL
34#   error "Python.h requires that stdio.h define NULL."
35#endif
36
37#include <string.h>
38#include <errno.h>
39#include <stdlib.h>
40#ifdef HAVE_UNISTD_H
41#include <unistd.h>
42#endif
43
44/* CAUTION:  Build setups should ensure that NDEBUG is defined on the
45 * compiler command line when building Python in release mode; else
46 * assert() calls won't be removed.
47 */
48#include <assert.h>
49
50#include "pyport.h"
51
52/* pyconfig.h or pyport.h may or may not define DL_IMPORT */
53#ifndef DL_IMPORT	/* declarations for DLL import/export */
54#define DL_IMPORT(RTYPE) RTYPE
55#endif
56#ifndef DL_EXPORT	/* declarations for DLL import/export */
57#define DL_EXPORT(RTYPE) RTYPE
58#endif
59
60/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
61 *  PYMALLOC_DEBUG is in error if pymalloc is not in use.
62 */
63#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
64#define PYMALLOC_DEBUG
65#endif
66#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
67#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
68#endif
69#include "pymem.h"
70
71#include "object.h"
72#include "objimpl.h"
73
74#include "pydebug.h"
75
76#include "unicodeobject.h"
77#include "intobject.h"
78#include "boolobject.h"
79#include "longobject.h"
80#include "floatobject.h"
81#ifndef WITHOUT_COMPLEX
82#include "complexobject.h"
83#endif
84#include "rangeobject.h"
85#include "stringobject.h"
86#include "bufferobject.h"
87#include "tupleobject.h"
88#include "listobject.h"
89#include "dictobject.h"
90#include "enumobject.h"
91#include "setobject.h"
92#include "methodobject.h"
93#include "moduleobject.h"
94#include "funcobject.h"
95#include "classobject.h"
96#include "fileobject.h"
97#include "cobject.h"
98#include "traceback.h"
99#include "sliceobject.h"
100#include "cellobject.h"
101#include "iterobject.h"
102#include "descrobject.h"
103#include "weakrefobject.h"
104
105#include "codecs.h"
106#include "pyerrors.h"
107
108#include "pystate.h"
109
110#include "modsupport.h"
111#include "pythonrun.h"
112#include "ceval.h"
113#include "sysmodule.h"
114#include "intrcheck.h"
115#include "import.h"
116
117#include "abstract.h"
118
119#include "compile.h"
120#include "eval.h"
121
122#include "pystrtod.h"
123
124/* _Py_Mangle is defined in compile.c */
125PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \
126				 char *buffer, size_t maxlen);
127
128/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */
129#define PyArg_GetInt(v, a)	PyArg_Parse((v), "i", (a))
130
131/* PyArg_NoArgs should not be necessary.
132   Set ml_flags in the PyMethodDef to METH_NOARGS. */
133#define PyArg_NoArgs(v)		PyArg_Parse(v, "")
134
135/* Convert a possibly signed character to a nonnegative int */
136/* XXX This assumes characters are 8 bits wide */
137#ifdef __CHAR_UNSIGNED__
138#define Py_CHARMASK(c)		(c)
139#else
140#define Py_CHARMASK(c)		((c) & 0xff)
141#endif
142
143#include "pyfpe.h"
144
145/* These definitions must match corresponding definitions in graminit.h.
146   There's code in compile.c that checks that they are the same. */
147#define Py_single_input 256
148#define Py_file_input 257
149#define Py_eval_input 258
150
151#ifdef HAVE_PTH
152/* GNU pth user-space thread support */
153#include <pth.h>
154#endif
155
156/* Define macros for inline documentation. */
157#define PyDoc_VAR(name) static char name[]
158#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
159#ifdef WITH_DOC_STRINGS
160#define PyDoc_STR(str) str
161#else
162#define PyDoc_STR(str) ""
163#endif
164
165#endif /* !Py_PYTHON_H */
166