@@ -839,24 +839,28 @@ static PyObject *Proxy_reduce(
839
839
840
840
/* ------------------------------------------------------------------------- */
841
841
842
- static PyObject * Proxy_round (
843
- ProxyObject * self , PyObject * args )
842
+ static PyObject * Proxy_round (ProxyObject * self , PyObject * args , PyObject * kwds )
844
843
{
845
844
PyObject * module = NULL ;
846
- PyObject * dict = NULL ;
847
845
PyObject * round = NULL ;
846
+ PyObject * ndigits = NULL ;
848
847
849
848
PyObject * result = NULL ;
850
849
850
+ char * const kwlist [] = { "ndigits" , NULL };
851
+
851
852
Proxy__ENSURE_WRAPPED_OR_RETURN_NULL (self );
852
853
854
+ if (!PyArg_ParseTupleAndKeywords (args , kwds , "|O:ObjectProxy" , kwlist , & ndigits )) {
855
+ return NULL ;
856
+ }
857
+
853
858
module = PyImport_ImportModule ("builtins" );
854
859
855
860
if (!module )
856
861
return NULL ;
857
862
858
- dict = PyModule_GetDict (module );
859
- round = PyDict_GetItemString (dict , "round" );
863
+ round = PyObject_GetAttrString (module , "round" );
860
864
861
865
if (!round ) {
862
866
Py_DECREF (module );
@@ -866,7 +870,7 @@ static PyObject *Proxy_round(
866
870
Py_INCREF (round );
867
871
Py_DECREF (module );
868
872
869
- result = PyObject_CallFunctionObjArgs (round , self -> wrapped , NULL );
873
+ result = PyObject_CallFunctionObjArgs (round , self -> wrapped , ndigits , NULL );
870
874
871
875
Py_DECREF (round );
872
876
@@ -1324,7 +1328,7 @@ static PyMethodDef Proxy_methods[] = {
1324
1328
{ "__reduce__" , (PyCFunction )Proxy_reduce , METH_NOARGS , 0 },
1325
1329
{ "__reduce_ex__" , (PyCFunction )Proxy_reduce , METH_O , 0 },
1326
1330
{ "__fspath__" , (PyCFunction )Proxy_fspath , METH_NOARGS , 0 },
1327
- { "__round__" , (PyCFunction )Proxy_round , METH_NOARGS , 0 },
1331
+ { "__round__" , (PyCFunction )Proxy_round , METH_VARARGS | METH_KEYWORDS , 0 },
1328
1332
{ "__aenter__" , (PyCFunction )Proxy_aenter , METH_NOARGS , 0 },
1329
1333
{ "__aexit__" , (PyCFunction )Proxy_aexit , METH_VARARGS | METH_KEYWORDS , 0 },
1330
1334
{ "__format__" , (PyCFunction )Proxy_format , METH_VARARGS , 0 },
0 commit comments