blob: d6e5b139ac67964e8457bfd57304157b0eabafb3 [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
Antoine Pitroua6a4dc82017-09-07 18:56:24 +020021#if defined(__sgi) && !defined(_SGI_MP_SOURCE)
Guido van Rossum90ce8481998-05-26 18:38:07 +000022#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>
Benjamin Petersonea137402018-09-13 21:57:31 -070035#ifndef MS_WINDOWS
Martin v. Löwiscdc44512002-01-12 11:05:12 +000036#include <unistd.h>
37#endif
stratakise768c862018-01-23 16:11:24 +010038#ifdef HAVE_CRYPT_H
Gregory P. Smith387512c2018-12-30 15:42:32 -080039#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE)
40/* Required for glibc to expose the crypt_r() function prototype. */
41# define _GNU_SOURCE
42# define _Py_GNU_SOURCE_FOR_CRYPT
43#endif
stratakise768c862018-01-23 16:11:24 +010044#include <crypt.h>
Gregory P. Smith387512c2018-12-30 15:42:32 -080045#ifdef _Py_GNU_SOURCE_FOR_CRYPT
46/* Don't leak the _GNU_SOURCE define to other headers. */
47# undef _GNU_SOURCE
48# undef _Py_GNU_SOURCE_FOR_CRYPT
49#endif
stratakise768c862018-01-23 16:11:24 +010050#endif
Guido van Rossumb2c075b2001-07-15 16:58:05 +000051
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +000052/* For size_t? */
Martin v. Löwisfe393f42004-07-27 15:57:24 +000053#ifdef HAVE_STDDEF_H
54#include <stddef.h>
55#endif
56
Tim Peters5defb172001-12-04 20:06:11 +000057/* CAUTION: Build setups should ensure that NDEBUG is defined on the
58 * compiler command line when building Python in release mode; else
59 * assert() calls won't be removed.
60 */
Tim Peters8315ea52000-07-23 19:28:35 +000061#include <assert.h>
62
Martin v. Löwis1e1fcef2002-05-15 18:24:06 +000063#include "pyport.h"
Victor Stinnerdfb866d2011-09-29 01:12:24 +020064#include "pymacro.h"
Martin v. Löwis1e1fcef2002-05-15 18:24:06 +000065
Gregory P. Smith1584a002018-11-12 12:07:14 -080066/* A convenient way for code to know if clang's memory sanitizer is enabled. */
67#if defined(__has_feature)
68# if __has_feature(memory_sanitizer)
Gregory P. Smith3015fb82018-11-12 22:01:22 -080069# if !defined(_Py_MEMORY_SANITIZER)
70# define _Py_MEMORY_SANITIZER
Gregory P. Smith1584a002018-11-12 12:07:14 -080071# endif
72# endif
73#endif
74
Tim Petersddea2082002-03-23 10:03:50 +000075/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
76 * PYMALLOC_DEBUG is in error if pymalloc is not in use.
77 */
78#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG)
79#define PYMALLOC_DEBUG
80#endif
81#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC)
82#error "PYMALLOC_DEBUG requires WITH_PYMALLOC"
83#endif
Christian Heimes53876d92008-04-19 00:31:39 +000084#include "pymath.h"
Alexander Belopolsky6fc4ade2010-08-05 17:34:27 +000085#include "pytime.h"
Peter Schneider-Kamp25f68942000-07-31 22:19:30 +000086#include "pymem.h"
87
Guido van Rossum174f95a1997-05-02 03:55:52 +000088#include "object.h"
89#include "objimpl.h"
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000090#include "typeslots.h"
Christian Heimes985ecdc2013-11-20 11:46:18 +010091#include "pyhash.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000092
93#include "pydebug.h"
94
Christian Heimes2c9c7a52008-05-26 13:42:13 +000095#include "bytearrayobject.h"
Guido van Rossum4dfe8a12006-04-22 23:28:04 +000096#include "bytesobject.h"
Guido van Rossum9e896b32000-04-05 20:11:21 +000097#include "unicodeobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +000098#include "longobject.h"
Martin v. Löwis9f2e3462007-07-21 17:22:18 +000099#include "longintrepr.h"
100#include "boolobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000101#include "floatobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000102#include "complexobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000103#include "rangeobject.h"
Travis E. Oliphantb99f7622007-08-18 11:21:56 +0000104#include "memoryobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000105#include "tupleobject.h"
106#include "listobject.h"
Guido van Rossum2ec90311997-05-13 21:23:32 +0000107#include "dictobject.h"
Eric Snow47db7172015-05-29 22:21:39 -0600108#include "odictobject.h"
Guido van Rossum7dab2422002-04-26 19:40:56 +0000109#include "enumobject.h"
Raymond Hettingera690a992003-11-16 16:17:49 +0000110#include "setobject.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000111#include "methodobject.h"
112#include "moduleobject.h"
113#include "funcobject.h"
114#include "classobject.h"
115#include "fileobject.h"
Benjamin Petersonb173f782009-05-05 22:31:58 +0000116#include "pycapsule.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000117#include "traceback.h"
118#include "sliceobject.h"
Jeremy Hyltonfbd849f2001-01-25 20:04:14 +0000119#include "cellobject.h"
Guido van Rossum59d1d2b2001-04-20 19:13:02 +0000120#include "iterobject.h"
Martin v. Löwis8d97e332004-06-27 15:43:12 +0000121#include "genobject.h"
Tim Peters6d6c1a32001-08-02 04:15:00 +0000122#include "descrobject.h"
Christian Heimes33fe8092008-04-13 13:53:33 +0000123#include "warnings.h"
Fred Drake19bc5782001-10-05 21:55:19 +0000124#include "weakrefobject.h"
Georg Brandl71c23d42010-11-30 09:30:54 +0000125#include "structseq.h"
Barry Warsaw409da152012-06-03 16:18:47 -0400126#include "namespaceobject.h"
Antoine Pitrou91f43802019-05-26 17:10:09 +0200127#include "picklebufobject.h"
Martin v. Löwis4d0d4712010-12-03 20:14:31 +0000128
Guido van Rossumbd7dfbc2000-03-10 22:34:00 +0000129#include "codecs.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000130#include "pyerrors.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000131
Victor Stinner331a6a52019-05-27 16:39:22 +0200132#include "cpython/initconfig.h"
Guido van Rossum618af4b1997-07-18 23:59:26 +0000133#include "pystate.h"
Yury Selivanovf23746a2018-01-22 19:11:18 -0500134#include "context.h"
Guido van Rossum618af4b1997-07-18 23:59:26 +0000135
Neal Norwitzadb69fc2005-12-17 20:54:49 +0000136#include "pyarena.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000137#include "modsupport.h"
Eric Snow6b4be192017-05-22 21:36:03 -0700138#include "compile.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000139#include "pythonrun.h"
Nick Coghland6009512014-11-20 21:39:37 +1000140#include "pylifecycle.h"
Tim Peters5ba58662001-07-16 02:29:45 +0000141#include "ceval.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000142#include "sysmodule.h"
Ethan Furman410ef8e2016-06-04 12:06:26 -0700143#include "osmodule.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000144#include "intrcheck.h"
145#include "import.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000146
Guido van Rossum174f95a1997-05-02 03:55:52 +0000147#include "abstract.h"
Benjamin Peterson8bc5b682009-05-09 18:10:51 +0000148#include "bltinmodule.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000149
Skip Montanaro6e098a12004-03-13 23:11:44 +0000150#include "eval.h"
151
Eric Smith6dc46f52009-04-27 20:39:49 +0000152#include "pyctype.h"
Martin v. Löwis737ea822004-06-08 18:52:54 +0000153#include "pystrtod.h"
Christian Heimes99170a52007-12-19 02:07:34 +0000154#include "pystrcmp.h"
Mark Dickinsonb08a53a2009-04-16 19:52:09 +0000155#include "dtoa.h"
Victor Stinner4e314432010-10-07 21:45:39 +0000156#include "fileutils.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000157#include "pyfpe.h"
Victor Stinner6279c1c2018-10-25 15:54:13 +0200158#include "tracemalloc.h"
Guido van Rossum174f95a1997-05-02 03:55:52 +0000159
Guido van Rossumd27b4f21997-05-02 04:00:11 +0000160#endif /* !Py_PYTHON_H */