@@ -204,57 +204,30 @@ PyDoc_STRVAR(pysqlite_connection_create_function__doc__,
204204"Creates a new function. Non-standard." );
205205
206206#define PYSQLITE_CONNECTION_CREATE_FUNCTION_METHODDEF \
207- {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_function__doc__},
207+ {"create_function", (PyCFunction)(void(*)(void))pysqlite_connection_create_function, METH_METHOD| METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_function__doc__},
208208
209209static PyObject *
210210pysqlite_connection_create_function_impl (pysqlite_Connection * self ,
211- const char * name , int narg ,
212- PyObject * func , int deterministic );
211+ PyTypeObject * cls , const char * name ,
212+ int narg , PyObject * func ,
213+ int deterministic );
213214
214215static PyObject *
215- pysqlite_connection_create_function (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
216+ pysqlite_connection_create_function (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
216217{
217218 PyObject * return_value = NULL ;
218219 static const char * const _keywords [] = {"name" , "narg" , "func" , "deterministic" , NULL };
219- static _PyArg_Parser _parser = {NULL , _keywords , "create_function" , 0 };
220- PyObject * argsbuf [4 ];
221- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE (kwnames ) : 0 ) - 3 ;
220+ static _PyArg_Parser _parser = {"siO|$p:create_function" , _keywords , 0 };
222221 const char * name ;
223222 int narg ;
224223 PyObject * func ;
225224 int deterministic = 0 ;
226225
227- args = _PyArg_UnpackKeywords (args , nargs , NULL , kwnames , & _parser , 3 , 3 , 0 , argsbuf );
228- if (!args ) {
229- goto exit ;
230- }
231- if (!PyUnicode_Check (args [0 ])) {
232- _PyArg_BadArgument ("create_function" , "argument 'name'" , "str" , args [0 ]);
233- goto exit ;
234- }
235- Py_ssize_t name_length ;
236- name = PyUnicode_AsUTF8AndSize (args [0 ], & name_length );
237- if (name == NULL ) {
226+ if (!_PyArg_ParseStackAndKeywords (args , nargs , kwnames , & _parser ,
227+ & name , & narg , & func , & deterministic )) {
238228 goto exit ;
239229 }
240- if (strlen (name ) != (size_t )name_length ) {
241- PyErr_SetString (PyExc_ValueError , "embedded null character" );
242- goto exit ;
243- }
244- narg = _PyLong_AsInt (args [1 ]);
245- if (narg == -1 && PyErr_Occurred ()) {
246- goto exit ;
247- }
248- func = args [2 ];
249- if (!noptargs ) {
250- goto skip_optional_kwonly ;
251- }
252- deterministic = PyObject_IsTrue (args [3 ]);
253- if (deterministic < 0 ) {
254- goto exit ;
255- }
256- skip_optional_kwonly :
257- return_value = pysqlite_connection_create_function_impl (self , name , narg , func , deterministic );
230+ return_value = pysqlite_connection_create_function_impl (self , cls , name , narg , func , deterministic );
258231
259232exit :
260233 return return_value ;
@@ -267,47 +240,29 @@ PyDoc_STRVAR(pysqlite_connection_create_aggregate__doc__,
267240"Creates a new aggregate. Non-standard." );
268241
269242#define PYSQLITE_CONNECTION_CREATE_AGGREGATE_METHODDEF \
270- {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_aggregate__doc__},
243+ {"create_aggregate", (PyCFunction)(void(*)(void))pysqlite_connection_create_aggregate, METH_METHOD| METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_aggregate__doc__},
271244
272245static PyObject *
273246pysqlite_connection_create_aggregate_impl (pysqlite_Connection * self ,
247+ PyTypeObject * cls ,
274248 const char * name , int n_arg ,
275249 PyObject * aggregate_class );
276250
277251static PyObject *
278- pysqlite_connection_create_aggregate (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
252+ pysqlite_connection_create_aggregate (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
279253{
280254 PyObject * return_value = NULL ;
281255 static const char * const _keywords [] = {"name" , "n_arg" , "aggregate_class" , NULL };
282- static _PyArg_Parser _parser = {NULL , _keywords , "create_aggregate" , 0 };
283- PyObject * argsbuf [3 ];
256+ static _PyArg_Parser _parser = {"siO:create_aggregate" , _keywords , 0 };
284257 const char * name ;
285258 int n_arg ;
286259 PyObject * aggregate_class ;
287260
288- args = _PyArg_UnpackKeywords (args , nargs , NULL , kwnames , & _parser , 3 , 3 , 0 , argsbuf );
289- if (!args ) {
290- goto exit ;
291- }
292- if (!PyUnicode_Check (args [0 ])) {
293- _PyArg_BadArgument ("create_aggregate" , "argument 'name'" , "str" , args [0 ]);
294- goto exit ;
295- }
296- Py_ssize_t name_length ;
297- name = PyUnicode_AsUTF8AndSize (args [0 ], & name_length );
298- if (name == NULL ) {
261+ if (!_PyArg_ParseStackAndKeywords (args , nargs , kwnames , & _parser ,
262+ & name , & n_arg , & aggregate_class )) {
299263 goto exit ;
300264 }
301- if (strlen (name ) != (size_t )name_length ) {
302- PyErr_SetString (PyExc_ValueError , "embedded null character" );
303- goto exit ;
304- }
305- n_arg = _PyLong_AsInt (args [1 ]);
306- if (n_arg == -1 && PyErr_Occurred ()) {
307- goto exit ;
308- }
309- aggregate_class = args [2 ];
310- return_value = pysqlite_connection_create_aggregate_impl (self , name , n_arg , aggregate_class );
265+ return_value = pysqlite_connection_create_aggregate_impl (self , cls , name , n_arg , aggregate_class );
311266
312267exit :
313268 return return_value ;
@@ -320,27 +275,26 @@ PyDoc_STRVAR(pysqlite_connection_set_authorizer__doc__,
320275"Sets authorizer callback. Non-standard." );
321276
322277#define PYSQLITE_CONNECTION_SET_AUTHORIZER_METHODDEF \
323- {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_authorizer__doc__},
278+ {"set_authorizer", (PyCFunction)(void(*)(void))pysqlite_connection_set_authorizer, METH_METHOD| METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_authorizer__doc__},
324279
325280static PyObject *
326281pysqlite_connection_set_authorizer_impl (pysqlite_Connection * self ,
282+ PyTypeObject * cls ,
327283 PyObject * callable );
328284
329285static PyObject *
330- pysqlite_connection_set_authorizer (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
286+ pysqlite_connection_set_authorizer (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
331287{
332288 PyObject * return_value = NULL ;
333289 static const char * const _keywords [] = {"authorizer_callback" , NULL };
334- static _PyArg_Parser _parser = {NULL , _keywords , "set_authorizer" , 0 };
335- PyObject * argsbuf [1 ];
290+ static _PyArg_Parser _parser = {"O:set_authorizer" , _keywords , 0 };
336291 PyObject * callable ;
337292
338- args = _PyArg_UnpackKeywords ( args , nargs , NULL , kwnames , & _parser , 1 , 1 , 0 , argsbuf );
339- if (! args ) {
293+ if (! _PyArg_ParseStackAndKeywords ( args , nargs , kwnames , & _parser ,
294+ & callable ) ) {
340295 goto exit ;
341296 }
342- callable = args [0 ];
343- return_value = pysqlite_connection_set_authorizer_impl (self , callable );
297+ return_value = pysqlite_connection_set_authorizer_impl (self , cls , callable );
344298
345299exit :
346300 return return_value ;
@@ -353,32 +307,27 @@ PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
353307"Sets progress handler callback. Non-standard." );
354308
355309#define PYSQLITE_CONNECTION_SET_PROGRESS_HANDLER_METHODDEF \
356- {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_progress_handler__doc__},
310+ {"set_progress_handler", (PyCFunction)(void(*)(void))pysqlite_connection_set_progress_handler, METH_METHOD| METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_progress_handler__doc__},
357311
358312static PyObject *
359313pysqlite_connection_set_progress_handler_impl (pysqlite_Connection * self ,
314+ PyTypeObject * cls ,
360315 PyObject * callable , int n );
361316
362317static PyObject *
363- pysqlite_connection_set_progress_handler (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
318+ pysqlite_connection_set_progress_handler (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
364319{
365320 PyObject * return_value = NULL ;
366321 static const char * const _keywords [] = {"progress_handler" , "n" , NULL };
367- static _PyArg_Parser _parser = {NULL , _keywords , "set_progress_handler" , 0 };
368- PyObject * argsbuf [2 ];
322+ static _PyArg_Parser _parser = {"Oi:set_progress_handler" , _keywords , 0 };
369323 PyObject * callable ;
370324 int n ;
371325
372- args = _PyArg_UnpackKeywords (args , nargs , NULL , kwnames , & _parser , 2 , 2 , 0 , argsbuf );
373- if (!args ) {
374- goto exit ;
375- }
376- callable = args [0 ];
377- n = _PyLong_AsInt (args [1 ]);
378- if (n == -1 && PyErr_Occurred ()) {
326+ if (!_PyArg_ParseStackAndKeywords (args , nargs , kwnames , & _parser ,
327+ & callable , & n )) {
379328 goto exit ;
380329 }
381- return_value = pysqlite_connection_set_progress_handler_impl (self , callable , n );
330+ return_value = pysqlite_connection_set_progress_handler_impl (self , cls , callable , n );
382331
383332exit :
384333 return return_value ;
@@ -393,27 +342,26 @@ PyDoc_STRVAR(pysqlite_connection_set_trace_callback__doc__,
393342"Non-standard." );
394343
395344#define PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF \
396- {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__},
345+ {"set_trace_callback", (PyCFunction)(void(*)(void))pysqlite_connection_set_trace_callback, METH_METHOD| METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__},
397346
398347static PyObject *
399348pysqlite_connection_set_trace_callback_impl (pysqlite_Connection * self ,
349+ PyTypeObject * cls ,
400350 PyObject * callable );
401351
402352static PyObject *
403- pysqlite_connection_set_trace_callback (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
353+ pysqlite_connection_set_trace_callback (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
404354{
405355 PyObject * return_value = NULL ;
406356 static const char * const _keywords [] = {"trace_callback" , NULL };
407- static _PyArg_Parser _parser = {NULL , _keywords , "set_trace_callback" , 0 };
408- PyObject * argsbuf [1 ];
357+ static _PyArg_Parser _parser = {"O:set_trace_callback" , _keywords , 0 };
409358 PyObject * callable ;
410359
411- args = _PyArg_UnpackKeywords ( args , nargs , NULL , kwnames , & _parser , 1 , 1 , 0 , argsbuf );
412- if (! args ) {
360+ if (! _PyArg_ParseStackAndKeywords ( args , nargs , kwnames , & _parser ,
361+ & callable ) ) {
413362 goto exit ;
414363 }
415- callable = args [0 ];
416- return_value = pysqlite_connection_set_trace_callback_impl (self , callable );
364+ return_value = pysqlite_connection_set_trace_callback_impl (self , cls , callable );
417365
418366exit :
419367 return return_value ;
@@ -720,38 +668,28 @@ PyDoc_STRVAR(pysqlite_connection_create_collation__doc__,
720668"Creates a collation function. Non-standard." );
721669
722670#define PYSQLITE_CONNECTION_CREATE_COLLATION_METHODDEF \
723- {"create_collation", (PyCFunction)(void(*)(void))pysqlite_connection_create_collation, METH_FASTCALL, pysqlite_connection_create_collation__doc__},
671+ {"create_collation", (PyCFunction)(void(*)(void))pysqlite_connection_create_collation, METH_METHOD| METH_FASTCALL|METH_KEYWORDS , pysqlite_connection_create_collation__doc__},
724672
725673static PyObject *
726674pysqlite_connection_create_collation_impl (pysqlite_Connection * self ,
675+ PyTypeObject * cls ,
727676 const char * name ,
728677 PyObject * callable );
729678
730679static PyObject *
731- pysqlite_connection_create_collation (pysqlite_Connection * self , PyObject * const * args , Py_ssize_t nargs )
680+ pysqlite_connection_create_collation (pysqlite_Connection * self , PyTypeObject * cls , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
732681{
733682 PyObject * return_value = NULL ;
683+ static const char * const _keywords [] = {"" , "" , NULL };
684+ static _PyArg_Parser _parser = {"sO:create_collation" , _keywords , 0 };
734685 const char * name ;
735686 PyObject * callable ;
736687
737- if (!_PyArg_CheckPositional ("create_collation" , nargs , 2 , 2 )) {
738- goto exit ;
739- }
740- if (!PyUnicode_Check (args [0 ])) {
741- _PyArg_BadArgument ("create_collation" , "argument 1" , "str" , args [0 ]);
742- goto exit ;
743- }
744- Py_ssize_t name_length ;
745- name = PyUnicode_AsUTF8AndSize (args [0 ], & name_length );
746- if (name == NULL ) {
747- goto exit ;
748- }
749- if (strlen (name ) != (size_t )name_length ) {
750- PyErr_SetString (PyExc_ValueError , "embedded null character" );
688+ if (!_PyArg_ParseStackAndKeywords (args , nargs , kwnames , & _parser ,
689+ & name , & callable )) {
751690 goto exit ;
752691 }
753- callable = args [1 ];
754- return_value = pysqlite_connection_create_collation_impl (self , name , callable );
692+ return_value = pysqlite_connection_create_collation_impl (self , cls , name , callable );
755693
756694exit :
757695 return return_value ;
@@ -819,4 +757,4 @@ pysqlite_connection_exit(pysqlite_Connection *self, PyObject *const *args, Py_ss
819757#ifndef PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
820758 #define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
821759#endif /* !defined(PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF) */
822- /*[clinic end generated code: output=5b7268875f33c016 input=a9049054013a1b77]*/
760+ /*[clinic end generated code: output=7567e5d716309258 input=a9049054013a1b77]*/
0 commit comments