summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-17 02:52:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-01-17 02:52:27 (GMT)
commit84b388bb809b186b9ccef90da817f22872f9578e (patch)
treebd9535cf5ee51db84e5b4d3b072289c1188bb45c /Python
parentf672fc7dc1c68cf75cad9109e39b4e39cd430687 (diff)
downloadcpython-84b388bb809b186b9ccef90da817f22872f9578e.zip
cpython-84b388bb809b186b9ccef90da817f22872f9578e.tar.gz
cpython-84b388bb809b186b9ccef90da817f22872f9578e.tar.bz2
getattr() uses METH_FASTCALL
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 31538c6..b269937 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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 */
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 *name;
- if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt))
+ if (!_PyArg_UnpackStack(args, nargs, "getattr", 2, 3, &v, &name, &dflt))
return NULL;
+ if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
+ return NULL;
+ }
+
if (!PyUnicode_Check(name)) {
PyErr_SetString(PyExc_TypeError,
"getattr(): attribute name must be string");
@@ -2622,7 +2627,7 @@ static PyMethodDef builtin_methods[] = {
BUILTIN_EVAL_METHODDEF
BUILTIN_EXEC_METHODDEF
BUILTIN_FORMAT_METHODDEF
- {"getattr", builtin_getattr, METH_VARARGS, getattr_doc},
+ {"getattr", (PyCFunction)builtin_getattr, METH_FASTCALL, getattr_doc},
BUILTIN_GLOBALS_METHODDEF
BUILTIN_HASATTR_METHODDEF
BUILTIN_HASH_METHODDEF