Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Side by Side Diff: Include/abstract.h

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Patch Set: Created 3 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Include/methodobject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Abstract Object Interface (many thanks to Jim Fulton) */ 1 /* Abstract Object Interface (many thanks to Jim Fulton) */
2 2
3 #ifndef Py_ABSTRACTOBJECT_H 3 #ifndef Py_ABSTRACTOBJECT_H
4 #define Py_ABSTRACTOBJECT_H 4 #define Py_ABSTRACTOBJECT_H
5 #ifdef __cplusplus 5 #ifdef __cplusplus
6 extern "C" { 6 extern "C" {
7 #endif 7 #endif
8 8
9 /* === Object Protocol ================================================== */ 9 /* === Object Protocol ================================================== */
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 /* Convert keyword arguments from the (stack, kwnames) format to a Python 163 /* Convert keyword arguments from the (stack, kwnames) format to a Python
164 dictionary. 164 dictionary.
165 165
166 kwnames must only contains str strings, no subclass, and all keys must be 166 kwnames must only contains str strings, no subclass, and all keys must be
167 unique. kwnames is not checked, usually these checks are done before or 167 unique. kwnames is not checked, usually these checks are done before or
168 later calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an 168 later calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an
169 error if a key is not a string. */ 169 error if a key is not a string. */
170 PyAPI_FUNC(PyObject *) _PyStack_AsDict( 170 PyAPI_FUNC(PyObject *) _PyStack_AsDict(
171 PyObject **values, 171 PyObject **values,
172 PyObject *kwnames); 172 PyObject *kwnames);
173
174 /* Convert (args, nargs, kwargs) into a (stack, nargs, kwnames).
175
176 Return a new stack which should be released by PyMem_Free(), or return
177 args unchanged if kwargs is NULL or an empty dictionary.
178
179 The stack uses borrowed references.
180
181 The type of keyword keys is not checked, these checks should be done
182 later (ex: _PyArg_ParseStack). */
183 PyAPI_FUNC(PyObject **) _PyStack_UnpackDict(
184 PyObject **args,
185 Py_ssize_t nargs,
186 PyObject *kwargs,
187 PyObject **kwnames,
188 PyObject *func);
189 173
190 /* Suggested size (number of positional arguments) for arrays of PyObject* 174 /* Suggested size (number of positional arguments) for arrays of PyObject*
191 allocated on a C stack to avoid allocating memory on the heap memory. Such 175 allocated on a C stack to avoid allocating memory on the heap memory. Such
192 array is used to pass positional arguments to call functions of the 176 array is used to pass positional arguments to call functions of the
193 _PyObject_FastCall() family. 177 _PyObject_FastCall() family.
194 178
195 The size is chosen to not abuse the C stack and so limit the risk of stack 179 The size is chosen to not abuse the C stack and so limit the risk of stack
196 overflow. The size is also chosen to allow using the small stack for most 180 overflow. The size is also chosen to allow using the small stack for most
197 function calls of the Python standard library. On 64-bit CPU, it allocates 181 function calls of the Python standard library. On 64-bit CPU, it allocates
198 40 bytes on the stack. */ 182 40 bytes on the stack. */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 _PyObject_FastCallDict((func), (args), (nargs), NULL) 222 _PyObject_FastCallDict((func), (args), (nargs), NULL)
239 223
240 #define _PyObject_CallNoArg(func) \ 224 #define _PyObject_CallNoArg(func) \
241 _PyObject_FastCallDict((func), NULL, 0, NULL) 225 _PyObject_FastCallDict((func), NULL, 0, NULL)
242 226
243 PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( 227 PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
244 PyObject *callable, 228 PyObject *callable,
245 PyObject *obj, 229 PyObject *obj,
246 PyObject *args, 230 PyObject *args,
247 PyObject *kwargs); 231 PyObject *kwargs);
232
233 PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(PyObject *func,
234 PyObject *obj,
235 PyObject **args,
236 Py_ssize_t nargs,
237 PyObject *kwnames);
248 238
249 PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, 239 PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
250 PyObject *result, 240 PyObject *result,
251 const char *where); 241 const char *where);
252 #endif /* Py_LIMITED_API */ 242 #endif /* Py_LIMITED_API */
253 243
254 244
245 #ifdef Py_BUILD_CORE
246 PyAPI_FUNC(PyObject *) _Py_FastCall_FromArgs(
247 PyObject *self,
248 fastternaryfunc fastcall,
249 PyObject **args,
250 Py_ssize_t nargs,
251 PyObject *kwargs);
252 #endif
253
254
255 /* Call a callable Python object 'callable', with arguments given by the 255 /* Call a callable Python object 'callable', with arguments given by the
256 tuple 'args'. If no arguments are needed, then 'args' can be *NULL*. 256 tuple 'args'. If no arguments are needed, then 'args' can be *NULL*.
257 257
258 Returns the result of the call on success, or *NULL* on failure. 258 Returns the result of the call on success, or *NULL* on failure.
259 259
260 This is the equivalent of the Python expression: 260 This is the equivalent of the Python expression:
261 callable(*args). */ 261 callable(*args). */
262 PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, 262 PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable,
263 PyObject *args); 263 PyObject *args);
264 264
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 const Py_ssize_t *shape); 1076 const Py_ssize_t *shape);
1077 PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, 1077 PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
1078 const Py_ssize_t *shape); 1078 const Py_ssize_t *shape);
1079 #endif /* !Py_LIMITED_API */ 1079 #endif /* !Py_LIMITED_API */
1080 1080
1081 1081
1082 #ifdef __cplusplus 1082 #ifdef __cplusplus
1083 } 1083 }
1084 #endif 1084 #endif
1085 #endif /* Py_ABSTRACTOBJECT_H */ 1085 #endif /* Py_ABSTRACTOBJECT_H */
OLDNEW
« no previous file with comments | « no previous file | Include/methodobject.h » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+