Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

modsupport.h 8.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
  1. #ifndef Py_MODSUPPORT_H
  2. #define Py_MODSUPPORT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* Module support interface */
  7. #include <stdarg.h>
  8. /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
  9. to mean Py_ssize_t */
  10. #ifdef PY_SSIZE_T_CLEAN
  11. #define PyArg_Parse _PyArg_Parse_SizeT
  12. #define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
  13. #define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
  14. #define PyArg_VaParse _PyArg_VaParse_SizeT
  15. #define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
  16. #define Py_BuildValue _Py_BuildValue_SizeT
  17. #define Py_VaBuildValue _Py_VaBuildValue_SizeT
  18. #ifndef Py_LIMITED_API
  19. #define _Py_VaBuildStack _Py_VaBuildStack_SizeT
  20. #endif
  21. #else
  22. #ifndef Py_LIMITED_API
  23. PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
  24. PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT(
  25. PyObject **small_stack,
  26. Py_ssize_t small_stack_len,
  27. const char *format,
  28. va_list va,
  29. Py_ssize_t *p_nargs);
  30. #endif /* !Py_LIMITED_API */
  31. #endif
  32. /* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */
  33. #if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
  34. PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
  35. PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
  36. PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
  37. const char *, char **, ...);
  38. PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
  39. PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
  40. const char *, char **, va_list);
  41. #endif
  42. PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *);
  43. PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
  44. PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
  45. PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
  46. #ifndef Py_LIMITED_API
  47. PyAPI_FUNC(int) _PyArg_UnpackStack(
  48. PyObject *const *args,
  49. Py_ssize_t nargs,
  50. const char *name,
  51. Py_ssize_t min,
  52. Py_ssize_t max,
  53. ...);
  54. PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
  55. PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
  56. #define _PyArg_NoKeywords(funcname, kwargs) \
  57. ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
  58. #define _PyArg_NoPositional(funcname, args) \
  59. ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
  60. #endif
  61. PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
  62. #ifndef Py_LIMITED_API
  63. PyAPI_FUNC(PyObject **) _Py_VaBuildStack(
  64. PyObject **small_stack,
  65. Py_ssize_t small_stack_len,
  66. const char *format,
  67. va_list va,
  68. Py_ssize_t *p_nargs);
  69. #endif
  70. #ifndef Py_LIMITED_API
  71. typedef struct _PyArg_Parser {
  72. const char *format;
  73. const char * const *keywords;
  74. const char *fname;
  75. const char *custom_msg;
  76. int pos; /* number of positional-only arguments */
  77. int min; /* minimal number of arguments */
  78. int max; /* maximal number of positional arguments */
  79. PyObject *kwtuple; /* tuple of keyword parameter names */
  80. struct _PyArg_Parser *next;
  81. } _PyArg_Parser;
  82. #ifdef PY_SSIZE_T_CLEAN
  83. #define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
  84. #define _PyArg_ParseStack _PyArg_ParseStack_SizeT
  85. #define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
  86. #define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
  87. #endif
  88. PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
  89. struct _PyArg_Parser *, ...);
  90. PyAPI_FUNC(int) _PyArg_ParseStack(
  91. PyObject *const *args,
  92. Py_ssize_t nargs,
  93. const char *format,
  94. ...);
  95. PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
  96. PyObject *const *args,
  97. Py_ssize_t nargs,
  98. PyObject *kwnames,
  99. struct _PyArg_Parser *,
  100. ...);
  101. PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
  102. struct _PyArg_Parser *, va_list);
  103. void _PyArg_Fini(void);
  104. #endif /* Py_LIMITED_API */
  105. PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
  106. PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
  107. PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
  108. #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
  109. #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
  110. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
  111. /* New in 3.5 */
  112. PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
  113. PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
  114. PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
  115. #endif
  116. #define Py_CLEANUP_SUPPORTED 0x20000
  117. #define PYTHON_API_VERSION 1013
  118. #define PYTHON_API_STRING "1013"
  119. /* The API version is maintained (independently from the Python version)
  120. so we can detect mismatches between the interpreter and dynamically
  121. loaded modules. These are diagnosed by an error message but
  122. the module is still loaded (because the mismatch can only be tested
  123. after loading the module). The error message is intended to
  124. explain the core dump a few seconds later.
  125. The symbol PYTHON_API_STRING defines the same value as a string
  126. literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
  127. Please add a line or two to the top of this log for each API
  128. version change:
  129. 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
  130. 19-Aug-2002 GvR 1012 Changes to string object struct for
  131. interning changes, saving 3 bytes.
  132. 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
  133. 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
  134. PyFrame_New(); Python 2.1a2
  135. 14-Mar-2000 GvR 1009 Unicode API added
  136. 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
  137. 3-Dec-1998 GvR 1008 Python 1.5.2b1
  138. 18-Jan-1997 GvR 1007 string interning and other speedups
  139. 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
  140. 30-Jul-1996 GvR Slice and ellipses syntax added
  141. 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
  142. 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
  143. 10-Jan-1995 GvR Renamed globals to new naming scheme
  144. 9-Jan-1995 GvR Initial version (incompatible with older API)
  145. */
  146. /* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
  147. Python 3, it will stay at the value of 3; changes to the limited API
  148. must be performed in a strictly backwards-compatible manner. */
  149. #define PYTHON_ABI_VERSION 3
  150. #define PYTHON_ABI_STRING "3"
  151. #ifdef Py_TRACE_REFS
  152. /* When we are tracing reference counts, rename module creation functions so
  153. modules compiled with incompatible settings will generate a
  154. link-time error. */
  155. #define PyModule_Create2 PyModule_Create2TraceRefs
  156. #define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs
  157. #endif
  158. PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
  159. int apiver);
  160. #ifndef Py_LIMITED_API
  161. PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*,
  162. int apiver);
  163. #endif
  164. #ifdef Py_LIMITED_API
  165. #define PyModule_Create(module) \
  166. PyModule_Create2(module, PYTHON_ABI_VERSION)
  167. #else
  168. #define PyModule_Create(module) \
  169. PyModule_Create2(module, PYTHON_API_VERSION)
  170. #endif
  171. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
  172. /* New in 3.5 */
  173. PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
  174. PyObject *spec,
  175. int module_api_version);
  176. #ifdef Py_LIMITED_API
  177. #define PyModule_FromDefAndSpec(module, spec) \
  178. PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
  179. #else
  180. #define PyModule_FromDefAndSpec(module, spec) \
  181. PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
  182. #endif /* Py_LIMITED_API */
  183. #endif /* New in 3.5 */
  184. #ifndef Py_LIMITED_API
  185. PyAPI_DATA(const char *) _Py_PackageContext;
  186. #endif
  187. #ifdef __cplusplus
  188. }
  189. #endif
  190. #endif /* !Py_MODSUPPORT_H */
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...