@@ -851,15 +851,22 @@ static PySequenceMethods mappingproxy_as_sequence = {
851851};
852852
853853static PyObject *
854- mappingproxy_get (mappingproxyobject * pp , PyObject * args )
854+ mappingproxy_get (mappingproxyobject * pp , PyObject * const * args , Py_ssize_t nargs )
855855{
856- PyObject * key , * def = Py_None ;
857- _Py_IDENTIFIER (get );
856+ /* newargs: mapping, key, default=None */
857+ PyObject * newargs [3 ];
858+ newargs [0 ] = pp -> mapping ;
859+ newargs [2 ] = Py_None ;
858860
859- if (!PyArg_UnpackTuple (args , "get" , 1 , 2 , & key , & def ))
861+ if (!_PyArg_UnpackStack (args , nargs , "get" , 1 , 2 ,
862+ & newargs [1 ], & newargs [2 ]))
863+ {
860864 return NULL ;
861- return _PyObject_CallMethodIdObjArgs (pp -> mapping , & PyId_get ,
862- key , def , NULL );
865+ }
866+ _Py_IDENTIFIER (get );
867+ return _PyObject_VectorcallMethodId (& PyId_get , newargs ,
868+ 3 | PY_VECTORCALL_ARGUMENTS_OFFSET ,
869+ NULL );
863870}
864871
865872static PyObject *
@@ -894,7 +901,7 @@ mappingproxy_copy(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
894901 to the underlying mapping */
895902
896903static PyMethodDef mappingproxy_methods [] = {
897- {"get" , (PyCFunction )mappingproxy_get , METH_VARARGS ,
904+ {"get" , (PyCFunction )mappingproxy_get , METH_FASTCALL ,
898905 PyDoc_STR ("D.get(k[,d]) -> D[k] if k in D, else d."
899906 " d defaults to None." )},
900907 {"keys" , (PyCFunction )mappingproxy_keys , METH_NOARGS ,
0 commit comments