@@ -993,14 +993,19 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
993993
994994/* AC: cannot convert yet, as needs PEP 457 group support in inspect */
995995static PyObject *
996- builtin_getattr (PyObject * self , PyObject * args )
996+ builtin_getattr (PyObject * self , PyObject * * args , Py_ssize_t nargs ,
997+ PyObject * kwnames )
997998{
998999 PyObject * v , * result , * dflt = NULL ;
9991000 PyObject * name ;
10001001
1001- if (!PyArg_UnpackTuple (args , "getattr" , 2 , 3 , & v , & name , & dflt ))
1002+ if (!_PyArg_UnpackStack (args , nargs , "getattr" , 2 , 3 , & v , & name , & dflt ))
10021003 return NULL ;
10031004
1005+ if (!_PyArg_NoStackKeywords ("getattr" , kwnames )) {
1006+ return NULL ;
1007+ }
1008+
10041009 if (!PyUnicode_Check (name )) {
10051010 PyErr_SetString (PyExc_TypeError ,
10061011 "getattr(): attribute name must be string" );
@@ -2622,7 +2627,7 @@ static PyMethodDef builtin_methods[] = {
26222627 BUILTIN_EVAL_METHODDEF
26232628 BUILTIN_EXEC_METHODDEF
26242629 BUILTIN_FORMAT_METHODDEF
2625- {"getattr" , builtin_getattr , METH_VARARGS , getattr_doc },
2630+ {"getattr" , ( PyCFunction ) builtin_getattr , METH_FASTCALL , getattr_doc },
26262631 BUILTIN_GLOBALS_METHODDEF
26272632 BUILTIN_HASATTR_METHODDEF
26282633 BUILTIN_HASH_METHODDEF
0 commit comments