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

Delta Between Two Patch Sets: Objects/typeobject.c

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Left Patch Set: Created 3 years, 2 months ago
Right Patch Set: Created 3 years, 2 months 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
(Both sides are equal)
1 /* Type object implementation */ 1 /* Type object implementation */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "frameobject.h" 4 #include "frameobject.h"
5 #include "structmember.h" 5 #include "structmember.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 9
10 /* Support type attribute cache */ 10 /* Support type attribute cache */
(...skipping 6205 matching lines...) Expand 10 before | Expand all | Expand 10 after
6216 res = PyObject_Call(meth, args, kwds); 6216 res = PyObject_Call(meth, args, kwds);
6217 6217
6218 Py_DECREF(meth); 6218 Py_DECREF(meth);
6219 return res; 6219 return res;
6220 } 6220 }
6221 6221
6222 static PyObject * 6222 static PyObject *
6223 slot_tp_fastcall(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw names) 6223 slot_tp_fastcall(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw names)
6224 { 6224 {
6225 _Py_IDENTIFIER(__call__); 6225 _Py_IDENTIFIER(__call__);
6226 PyObject *meth = lookup_method(self, &PyId___call__); 6226 PyObject *meth = lookup_method(self, &PyId___call__);
inada.naoki 2017/01/26 10:10:38 slot_tp_call has _Py_IDENTIFIER(__call__) too. Let
6227 PyObject *res; 6227 PyObject *res;
6228 6228
6229 if (meth == NULL) 6229 if (meth == NULL)
6230 return NULL; 6230 return NULL;
6231 6231
6232 res = _PyObject_FastCallKeywords(meth, args, nargs, kwnames); 6232 res = _PyObject_FastCallKeywords(meth, args, nargs, kwnames);
6233 6233
6234 Py_DECREF(meth); 6234 Py_DECREF(meth);
6235 return res; 6235 return res;
6236 } 6236 }
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
7290 return -1; 7290 return -1;
7291 } 7291 }
7292 else { 7292 else {
7293 int use_fastwrapper; 7293 int use_fastwrapper;
7294 void *wrapped; 7294 void *wrapped;
7295 7295
7296 if (*ptr == fastcall_wrapper) { 7296 if (*ptr == fastcall_wrapper) {
7297 /* A wrapper must not call fastcall_wrapper() but the specific 7297 /* A wrapper must not call fastcall_wrapper() but the specific
7298 tp_fastcall. fastcall_wrapper() is called with an instance. 7298 tp_fastcall. fastcall_wrapper() is called with an instance.
7299 From an instance, it's not possible to find the specific 7299 From an instance, it's not possible to find the specific
7300 function. */ 7300 function. */
haypo 2017/01/26 03:35:21 This comment should be rephrased.
7301 use_fastwrapper = 1; 7301 use_fastwrapper = 1;
7302 wrapped = type->tp_fastcall; 7302 wrapped = type->tp_fastcall;
7303 } 7303 }
7304 else { 7304 else {
7305 use_fastwrapper = 0; 7305 use_fastwrapper = 0;
7306 wrapped = *ptr; 7306 wrapped = *ptr;
7307 } 7307 }
7308 assert(wrapped != NULL); 7308 assert(wrapped != NULL);
7309 7309
7310 descr = _PyDescr_NewWrapperEx(type, p, wrapped, use_fastwrapper); 7310 descr = _PyDescr_NewWrapperEx(type, p, wrapped, use_fastwrapper);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
7709 0, /* tp_base */ 7709 0, /* tp_base */
7710 0, /* tp_dict */ 7710 0, /* tp_dict */
7711 super_descr_get, /* tp_descr_get */ 7711 super_descr_get, /* tp_descr_get */
7712 0, /* tp_descr_set */ 7712 0, /* tp_descr_set */
7713 0, /* tp_dictoffset */ 7713 0, /* tp_dictoffset */
7714 super_init, /* tp_init */ 7714 super_init, /* tp_init */
7715 PyType_GenericAlloc, /* tp_alloc */ 7715 PyType_GenericAlloc, /* tp_alloc */
7716 PyType_GenericNew, /* tp_new */ 7716 PyType_GenericNew, /* tp_new */
7717 PyObject_GC_Del, /* tp_free */ 7717 PyObject_GC_Del, /* tp_free */
7718 }; 7718 };
LEFTRIGHT

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