@@ -851,15 +851,22 @@ static PySequenceMethods mappingproxy_as_sequence = {
851
851
};
852
852
853
853
static PyObject *
854
- mappingproxy_get (mappingproxyobject * pp , PyObject * args )
854
+ mappingproxy_get (mappingproxyobject * pp , PyObject * const * args , Py_ssize_t nargs )
855
855
{
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 ;
858
860
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
+ {
860
864
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 );
863
870
}
864
871
865
872
static PyObject *
@@ -894,7 +901,7 @@ mappingproxy_copy(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
894
901
to the underlying mapping */
895
902
896
903
static PyMethodDef mappingproxy_methods [] = {
897
- {"get" , (PyCFunction )mappingproxy_get , METH_VARARGS ,
904
+ {"get" , (PyCFunction )mappingproxy_get , METH_FASTCALL ,
898
905
PyDoc_STR ("D.get(k[,d]) -> D[k] if k in D, else d."
899
906
" d defaults to None." )},
900
907
{"keys" , (PyCFunction )mappingproxy_keys , METH_NOARGS ,
0 commit comments