Python.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #ifndef Py_PYTHON_H
  2. #define Py_PYTHON_H
  3. /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
  4. /* Include nearly all Python header files */
  5. #include "patchlevel.h"
  6. #include "pyconfig.h"
  7. #include "pymacconfig.h"
  8. /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the
  9. * old symbol for the benefit of extension modules written before then
  10. * that may be conditionalizing on it. The core doesn't use it anymore.
  11. */
  12. #ifndef WITH_CYCLE_GC
  13. #define WITH_CYCLE_GC 1
  14. #endif
  15. #include <limits.h>
  16. #ifndef UCHAR_MAX
  17. #error "Something's broken. UCHAR_MAX should be defined in limits.h."
  18. #endif
  19. #if UCHAR_MAX != 255
  20. #error "Python's source code assumes C's unsigned char is an 8-bit type."
  21. #endif
  22. #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
  23. #define _SGI_MP_SOURCE
  24. #endif
  25. #include <stdio.h>
  26. #ifndef NULL
  27. # error "Python.h requires that stdio.h define NULL."
  28. #endif
  29. #include <string.h>
  30. #ifdef HAVE_ERRNO_H
  31. #include <errno.h>
  32. #endif
  33. #include <stdlib.h>
  34. #ifdef HAVE_UNISTD_H
  35. #include <unistd.h>
  36. #endif
  37. /* For size_t? */
  38. #ifdef HAVE_STDDEF_H
  39. #include <stddef.h>
  40. #endif
  41. /* CAUTION: Build setups should ensure that NDEBUG is defined on the
  42. * compiler command line when building Python in release mode; else
  43. * assert() calls won't be removed.
  44. */
  45. #include <assert.h>
  46. #include "pyport.h"
  47. /* pyconfig.h or pyport.h may or may not define DL_IMPORT */
  48. #ifndef DL_IMPORT /* declarations for DLL import/export */
  49. #define DL_IMPORT(RTYPE) RTYPE
  50. #endif
  51. #ifndef DL_EXPORT /* declarations for DLL import/export */
  52. #define DL_EXPORT(RTYPE) RTYPE
  53. #endif
  54. /* 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
  63. #include "pymath.h"
  64. #include "pymem.h"
  65. #include "object.h"
  66. #include "objimpl.h"
  67. #include "pydebug.h"
  68. #include "unicodeobject.h"
  69. #include "intobject.h"
  70. #include "boolobject.h"
  71. #include "longobject.h"
  72. #include "floatobject.h"
  73. #ifndef WITHOUT_COMPLEX
  74. #include "complexobject.h"
  75. #endif
  76. #include "rangeobject.h"
  77. #include "stringobject.h"
  78. #include "memoryobject.h"
  79. #include "bufferobject.h"
  80. #include "bytesobject.h"
  81. #include "bytearrayobject.h"
  82. #include "tupleobject.h"
  83. #include "listobject.h"
  84. #include "dictobject.h"
  85. #include "enumobject.h"
  86. #include "setobject.h"
  87. #include "methodobject.h"
  88. #include "moduleobject.h"
  89. #include "funcobject.h"
  90. #include "classobject.h"
  91. #include "fileobject.h"
  92. #include "cobject.h"
  93. #include "pycapsule.h"
  94. #include "traceback.h"
  95. #include "sliceobject.h"
  96. #include "cellobject.h"
  97. #include "iterobject.h"
  98. #include "genobject.h"
  99. #include "descrobject.h"
  100. #include "warnings.h"
  101. #include "weakrefobject.h"
  102. #include "codecs.h"
  103. #include "pyerrors.h"
  104. #include "pystate.h"
  105. #include "pyarena.h"
  106. #include "modsupport.h"
  107. #include "pythonrun.h"
  108. #include "ceval.h"
  109. #include "sysmodule.h"
  110. #include "intrcheck.h"
  111. #include "import.h"
  112. #include "abstract.h"
  113. #include "compile.h"
  114. #include "eval.h"
  115. #include "pyctype.h"
  116. #include "pystrtod.h"
  117. #include "pystrcmp.h"
  118. #include "dtoa.h"
  119. /* _Py_Mangle is defined in compile.c */
  120. PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
  121. /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */
  122. #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
  123. /* PyArg_NoArgs should not be necessary.
  124. Set ml_flags in the PyMethodDef to METH_NOARGS. */
  125. #define PyArg_NoArgs(v) PyArg_Parse(v, "")
  126. /* Argument must be a char or an int in [-128, 127] or [0, 255]. */
  127. #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
  128. #include "pyfpe.h"
  129. /* These definitions must match corresponding definitions in graminit.h.
  130. There's code in compile.c that checks that they are the same. */
  131. #define Py_single_input 256
  132. #define Py_file_input 257
  133. #define Py_eval_input 258
  134. #ifdef HAVE_PTH
  135. /* GNU pth user-space thread support */
  136. #include <pth.h>
  137. #endif
  138. /* Define macros for inline documentation. */
  139. #define PyDoc_VAR(name) static char name[]
  140. #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
  141. #ifdef WITH_DOC_STRINGS
  142. #define PyDoc_STR(str) str
  143. #else
  144. #define PyDoc_STR(str) ""
  145. #endif
  146. #endif /* !Py_PYTHON_H */