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

Delta Between Two Patch Sets: Objects/methodobject.c

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Left Patch Set: Created 3 years ago
Right Patch Set: Created 3 years 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 1
2 /* Method object implementation */ 2 /* Method object implementation */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 #include "structmember.h" 5 #include "structmember.h"
6 6
7 /* Free list for method objects to safe malloc/free overhead 7 /* Free list for method objects to safe malloc/free overhead
8 * The m_self element is used to chain the objects. 8 * The m_self element is used to chain the objects.
9 */ 9 */
10 static PyCFunctionObject *free_list = NULL; 10 static PyCFunctionObject *free_list = NULL;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 PyObject *self, *result; 95 PyObject *self, *result;
96 int flags; 96 int flags;
97 PyObject *argstuple; 97 PyObject *argstuple;
98 98
99 /* _PyCFunction_FastCallDict() must not be called with an exception set, 99 /* _PyCFunction_FastCallDict() must not be called with an exception set,
100 because it may clear it (directly or indirectly) and so the 100 because it may clear it (directly or indirectly) and so the
101 caller loses its exception */ 101 caller loses its exception */
102 assert(!PyErr_Occurred()); 102 assert(!PyErr_Occurred());
103 103
104 assert(PyCFunction_Check(func_obj)); 104 assert(PyCFunction_Check(func_obj));
105 assert(func_obj != NULL); 105 assert(func_obj != NULL);
haypo 2017/01/26 03:35:21 assertions in the wrong order.
106 assert(nargs >= 0); 106 assert(nargs >= 0);
107 assert(nargs == 0 || args != NULL); 107 assert(nargs == 0 || args != NULL);
108 assert(kwargs == NULL || PyDict_Check(kwargs)); 108 assert(kwargs == NULL || PyDict_Check(kwargs));
109 109
110 func = (PyCFunctionObject*)func_obj; 110 func = (PyCFunctionObject*)func_obj;
111 meth = PyCFunction_GET_FUNCTION(func); 111 meth = PyCFunction_GET_FUNCTION(func);
112 self = PyCFunction_GET_SELF(func); 112 self = PyCFunction_GET_SELF(func);
113 flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEX IST); 113 flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEX IST);
114 114
115 switch (flags) 115 switch (flags)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 PyObject * 195 PyObject *
196 _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, 196 _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
197 PyObject **args, Py_ssize_t nargs, 197 PyObject **args, Py_ssize_t nargs,
198 PyObject *kwnames) 198 PyObject *kwnames)
199 { 199 {
200 PyCFunction meth; 200 PyCFunction meth;
201 PyObject *result; 201 PyObject *result;
202 Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); 202 Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
203 int flags; 203 int flags;
204 204
205 assert(nargs >= 0); 205 assert(nargs >= 0);
haypo 2017/01/26 03:35:21 assert(method != NULL);
206 assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); 206 assert(kwnames == NULL || PyTuple_CheckExact(kwnames));
207 assert((nargs == 0 && nkwargs == 0) || args != NULL); 207 assert((nargs == 0 && nkwargs == 0) || args != NULL);
208 /* kwnames must only contains str strings, no subclass, and all keys must 208 /* kwnames must only contains str strings, no subclass, and all keys must
209 be unique */ 209 be unique */
210 210
211 /* _PyCFunction_FastCallKeywords() must not be called with an exception 211 /* _PyCFunction_FastCallKeywords() must not be called with an exception
212 set, because it can clear it (directly or indirectly) and so the caller 212 set, because it can clear it (directly or indirectly) and so the caller
213 loses its exception */ 213 loses its exception */
214 assert(!PyErr_Occurred()); 214 assert(!PyErr_Occurred());
215 215
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 574
575 /* Print summary info about the state of the optimized allocator */ 575 /* Print summary info about the state of the optimized allocator */
576 void 576 void
577 _PyCFunction_DebugMallocStats(FILE *out) 577 _PyCFunction_DebugMallocStats(FILE *out)
578 { 578 {
579 _PyDebugAllocatorStats(out, 579 _PyDebugAllocatorStats(out,
580 "free PyCFunctionObject", 580 "free PyCFunctionObject",
581 numfree, sizeof(PyCFunctionObject)); 581 numfree, sizeof(PyCFunctionObject));
582 } 582 }
LEFTRIGHT

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