blob: 31c6280793635d86627c4917777913136b2590fb [file] [log] [blame]
Guido van Rossumd27b4f21997-05-02 04:00:11 +00001#ifndef Py_PYTHON_H
2#define Py_PYTHON_H
Guido van Rossum174f95a1997-05-02 03:55:52 +00003/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
4
Guido van Rossum174f95a1997-05-02 03:55:52 +00005/* Include nearly all Python header files */
6
Guido van Rossumf1176c41999-01-03 12:40:24 +00007#include "patchlevel.h"
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00008#include "pyconfig.h"
Georg Brandlfcaf9102008-07-16 02:17:56 +00009#include "pymacconfig.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000010
Fred Draked5fadf72000-09-26 05:46:01 +000011#include <limits.h>
Fred Draked5fadf72000-09-26 05:46:01 +000012
Skip Montanaroac4ea132003-12-22 16:31:41 +000013#ifndef UCHAR_MAX
14#error "Something's broken. UCHAR_MAX should be defined in limits.h."
15#endif
16
17#if UCHAR_MAX != 255
Tim Peters0490fe92003-12-22 18:10:51 +000018#error "Python's source code assumes C's unsigned char is an 8-bit type."
Skip Montanaroac4ea132003-12-22 16:31:41 +000019#endif
20
Guido van Rossum90ce8481998-05-26 18:38:07 +000021#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
22#define _SGI_MP_SOURCE
23#endif
24
Guido van Rossum174f95a1997-05-02 03:55:52 +000025#include <stdio.h>
Tim Peters4826a892000-09-10 01:02:41 +000026#ifndef NULL
27# error "Python.h requires that stdio.h define NULL."
28#endif
29
Guido van Rossum174f95a1997-05-02 03:55:52 +000030#include <string.h>
Thomas Wouters0e3f5912006-08-11 14:57:12 +000031#ifdef HAVE_ERRNO_H
Guido van Rossum174f95a1997-05-02 03:55:52 +000032#include <errno.h>
Thomas Wouters477c8d52006-05-27 19:21:47 +000033#endif
Guido van Rossum174f95a1997-05-02 03:55:52 +000034#include <stdlib.h>
Martin v. Löwiscdc44512002-01-12 11:05:12 +000035#ifdef HAVE_UNISTD_H
36#include <unistd.h>
37#endif
Guido van Rossumb2c075b2001-07-15 16:58:05 +000038
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +000039/* For size_t? */
Martin v. Löwisfe393f42004-07-27 15:57:24 +000040#ifdef HAVE_STDDEF_H
41#include <stddef.h>
42#endif
43
Tim Peters5defb172001-12-04 20:06:11 +000044/* 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 */
Tim Peters8315ea52000-07-23 19:28:35 +000048#include <assert.h>
49
Martin v. Löwis1e1fcef2002-05-15 18:24:06 +000050#include "pyport.h"
51
Jeffrey Yasskin39370832010-05-03 19:29:34 +000052#include "pyatomic.h"
53
Tim Petersddea2082002-03-23 10:03:50 +000054/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
55 * PYMALLOC_DEBUG is in error if pymalloc is not in use.
56 */
57#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
58#define PYMALLOC_DEBUG
59#endif
60#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
61#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
62#endif
Christian Heimes53876d92008-04-19 00:31:39 +000063#include "pymath.h"
Alexander Belopolsky6fc4ade2010-08-05 17:34:27 +000064#include "pytime.h"
Peter Schneider-Kamp25f68942000-07-31 22:19:30 +000065#include "pymem.h"
66
Guido van Rossum174f95a1997-05-02 03:55:52 +000067#include "object.h"
68#include "objimpl.h"
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000069#include "typeslots.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000070
71#include "pydebug.h"
72
Christian Heimes2c9c7a52008-05-26 13:42:13 +000073#include "bytearrayobject.h"
Guido van Rossum4dfe8a12006-04-22 23:28:04 +000074#include "bytesobject.h"
Guido van Rossum9e896b32000-04-05 20:11:21 +000075#include "unicodeobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000076#include "longobject.h"
Martin v. Löwis9f2e3462007-07-21 17:22:18 +000077#include "longintrepr.h"
78#include "boolobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000079#include "floatobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000080#include "complexobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000081#include "rangeobject.h"
Travis E. Oliphantb99f7622007-08-18 11:21:56 +000082#include "memoryobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000083#include "tupleobject.h"
84#include "listobject.h"
Guido van Rossum2ec90311997-05-13 21:23:32 +000085#include "dictobject.h"
Guido van Rossum7dab2422002-04-26 19:40:56 +000086#include "enumobject.h"
Raymond Hettingera690a992003-11-16 16:17:49 +000087#include "setobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000088#include "methodobject.h"
89#include "moduleobject.h"
90#include "funcobject.h"
91#include "classobject.h"
92#include "fileobject.h"
Benjamin Petersonb173f782009-05-05 22:31:58 +000093#include "pycapsule.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000094#include "traceback.h"
95#include "sliceobject.h"
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +000096#include "cellobject.h"
Guido van Rossum59d1d2b2001-04-20 19:13:02 +000097#include "iterobject.h"
Martin v. Löwis8d97e332004-06-27 15:43:12 +000098#include "genobject.h"
Tim Peters6d6c1a32001-08-02 04:15:00 +000099#include "descrobject.h"
Christian Heimes33fe8092008-04-13 13:53:33 +0000100#include "warnings.h"
Fred Drake19bc5782001-10-05 21:55:19 +0000101#include "weakrefobject.h"
Georg Brandl71c23d42010-11-30 09:30:54 +0000102#include "structseq.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000103
Martin v. Löwis4d0d4712010-12-03 20:14:31 +0000104
Guido van Rossumbd7dfbc2000-03-10 22:34:00 +0000105#include "codecs.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000106#include "pyerrors.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000107
Guido van Rossum618af4b1997-07-18 23:59:26 +0000108#include "pystate.h"
109
Neal Norwitzadb69fc2005-12-17 20:54:49 +0000110#include "pyarena.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000111#include "modsupport.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000112#include "pythonrun.h"
Tim Peters5ba58662001-07-16 02:29:45 +0000113#include "ceval.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000114#include "sysmodule.h"
115#include "intrcheck.h"
116#include "import.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000117
Guido van Rossum174f95a1997-05-02 03:55:52 +0000118#include "abstract.h"
Benjamin Peterson8bc5b682009-05-09 18:10:51 +0000119#include "bltinmodule.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000120
Skip Montanaro6e098a12004-03-13 23:11:44 +0000121#include "compile.h"
122#include "eval.h"
123
Eric Smith6dc46f52009-04-27 20:39:49 +0000124#include "pyctype.h"
Martin v. Löwis737ea822004-06-08 18:52:54 +0000125#include "pystrtod.h"
Christian Heimes99170a52007-12-19 02:07:34 +0000126#include "pystrcmp.h"
Mark Dickinsonb08a53a2009-04-16 19:52:09 +0000127#include "dtoa.h"
Victor Stinner4e314432010-10-07 21:45:39 +0000128#include "fileutils.h"
Martin v. Löwis737ea822004-06-08 18:52:54 +0000129
Collin Winterdfa66c12010-04-17 00:20:57 +0000130#ifdef __cplusplus
131extern "C" {
132#endif
Victor Stinnerf2e08b32010-08-13 23:29:08 +0000133
Raymond Hettinger0ae0c072002-06-20 22:23:15 +0000134/* _Py_Mangle is defined in compile.c */
Martin v. Löwis4d0d4712010-12-03 20:14:31 +0000135#ifndef Py_LIMITED_API
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000136PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
Martin v. Löwis4d0d4712010-12-03 20:14:31 +0000137#endif
Raymond Hettinger0ae0c072002-06-20 22:23:15 +0000138
Collin Winterdfa66c12010-04-17 00:20:57 +0000139#ifdef __cplusplus
140}
141#endif
Philip Jenveye53de3d2010-04-14 03:01:39 +0000142
Stefan Krah36d2e672010-07-19 12:36:57 +0000143/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
Christian Heimesbbe741d2008-03-28 10:53:29 +0000144#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
Guido van Rossum174f95a1997-05-02 03:55:52 +0000145
146#include "pyfpe.h"
147
Greg Ward95811442000-05-28 20:29:48 +0000148/* These definitions must match corresponding definitions in graminit.h.
Guido van Rossumb05a5c71997-05-07 17:46:13 +0000149 There's code in compile.c that checks that they are the same. */
150#define Py_single_input 256
151#define Py_file_input 257
152#define Py_eval_input 258
153
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +0000154/* Define macros for inline documentation. */
155#define PyDoc_VAR(name) static char name[]
156#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
157#ifdef WITH_DOC_STRINGS
158#define PyDoc_STR(str) str
159#else
160#define PyDoc_STR(str) ""
161#endif
162
Guido van Rossumd27b4f21997-05-02 04:00:11 +0000163#endif /* !Py_PYTHON_H */