@@ -83,6 +83,29 @@ md_clear(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
8383 Py_RETURN_NONE ;
8484}
8585
86+ static PyObject *
87+ md_setdefault (PyObject * self , PyObject * const * args , Py_ssize_t nargs )
88+ {
89+ printf ("000000\n" );
90+ mod_state * state = get_mod_state (self );
91+ if (check_nargs ("md_setdefault" , nargs , 3 ) < 0 ) {
92+ return NULL ;
93+ }
94+ PyObject * result = NULL ;
95+ int ret =
96+ MultiDict_SetDefault (state -> capi , args [0 ], args [1 ], args [2 ], & result );
97+ if (ret < 0 ) {
98+ return NULL ;
99+ }
100+ assert (result != NULL );
101+ PyObject * val = PyBool_FromLong (ret );
102+ if (val == NULL ) {
103+ Py_CLEAR (result );
104+ return NULL ;
105+ }
106+ return PyTuple_Pack (2 , result , val );
107+ }
108+
86109/* module slots */
87110
88111static int
@@ -108,6 +131,7 @@ static PyMethodDef module_methods[] = {
108131 {"md_new" , (PyCFunction )md_new , METH_FASTCALL },
109132 {"md_add" , (PyCFunction )md_add , METH_FASTCALL },
110133 {"md_clear" , (PyCFunction )md_clear , METH_FASTCALL },
134+ {"md_setdefault" , (PyCFunction )md_setdefault , METH_FASTCALL },
111135 {NULL , NULL } /* sentinel */
112136};
113137
0 commit comments