Kaydet (Commit) 84b388bb authored tarafından Victor Stinner's avatar Victor Stinner

getattr() uses METH_FASTCALL

üst f672fc7d
...@@ -993,14 +993,19 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals, ...@@ -993,14 +993,19 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
/* AC: cannot convert yet, as needs PEP 457 group support in inspect */ /* AC: cannot convert yet, as needs PEP 457 group support in inspect */
static PyObject * static PyObject *
builtin_getattr(PyObject *self, PyObject *args) builtin_getattr(PyObject *self, PyObject **args, Py_ssize_t nargs,
PyObject *kwnames)
{ {
PyObject *v, *result, *dflt = NULL; PyObject *v, *result, *dflt = NULL;
PyObject *name; PyObject *name;
if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt)) if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt))
return NULL; return NULL;
if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
return NULL;
}
if (!PyUnicode_Check(name)) { if (!PyUnicode_Check(name)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"getattr(): attribute name must be string"); "getattr(): attribute name must be string");
...@@ -2622,7 +2627,7 @@ static PyMethodDef builtin_methods[] = { ...@@ -2622,7 +2627,7 @@ static PyMethodDef builtin_methods[] = {
BUILTIN_EVAL_METHODDEF BUILTIN_EVAL_METHODDEF
BUILTIN_EXEC_METHODDEF BUILTIN_EXEC_METHODDEF
BUILTIN_FORMAT_METHODDEF BUILTIN_FORMAT_METHODDEF
{"getattr", builtin_getattr, METH_VARARGS, getattr_doc}, {"getattr", (PyCFunction)builtin_getattr, METH_FASTCALL, getattr_doc},
BUILTIN_GLOBALS_METHODDEF BUILTIN_GLOBALS_METHODDEF
BUILTIN_HASATTR_METHODDEF BUILTIN_HASATTR_METHODDEF
BUILTIN_HASH_METHODDEF BUILTIN_HASH_METHODDEF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment