@@ -341,13 +341,13 @@ read_bool_internal(PyObject *data) {
341341}
342342
343343static PyObject *
344- read_bool (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
345- static const char * const kwlist [] = {"data" , 0 };
346- static CPyArg_Parser parser = {"O:read_bool" , kwlist , 0 };
347- PyObject * data ;
348- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
344+ read_bool (PyObject * self , PyObject * const * args , size_t nargs ) {
345+ if (unlikely (nargs != 1 )) {
346+ PyErr_Format (PyExc_TypeError ,
347+ "read_bool() takes exactly 1 argument (%zu given)" , nargs );
349348 return NULL ;
350349 }
350+ PyObject * data = args [0 ];
351351 _CHECK_READ_BUFFER (data , NULL )
352352 char res = read_bool_internal (data );
353353 if (unlikely (res == CPY_BOOL_ERROR ))
@@ -365,14 +365,14 @@ write_bool_internal(PyObject *data, char value) {
365365}
366366
367367static PyObject *
368- write_bool (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
369- static const char * const kwlist [] = {"data" , "value" , 0 };
370- static CPyArg_Parser parser = {"OO:write_bool" , kwlist , 0 };
371- PyObject * data ;
372- PyObject * value ;
373- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
368+ write_bool (PyObject * self , PyObject * const * args , size_t nargs ) {
369+ if (unlikely (nargs != 2 )) {
370+ PyErr_Format (PyExc_TypeError ,
371+ "write_bool() takes exactly 2 arguments (%zu given)" , nargs );
374372 return NULL ;
375373 }
374+ PyObject * data = args [0 ];
375+ PyObject * value = args [1 ];
376376 _CHECK_WRITE_BUFFER (data , NULL )
377377 if (unlikely (!PyBool_Check (value ))) {
378378 PyErr_SetString (PyExc_TypeError , "value must be a bool" );
@@ -445,13 +445,13 @@ read_str_internal(PyObject *data) {
445445}
446446
447447static PyObject *
448- read_str (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
449- static const char * const kwlist [] = {"data" , 0 };
450- static CPyArg_Parser parser = {"O:read_str" , kwlist , 0 };
451- PyObject * data ;
452- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
448+ read_str (PyObject * self , PyObject * const * args , size_t nargs ) {
449+ if (unlikely (nargs != 1 )) {
450+ PyErr_Format (PyExc_TypeError ,
451+ "read_str() takes exactly 1 argument (%zu given)" , nargs );
453452 return NULL ;
454453 }
454+ PyObject * data = args [0 ];
455455 _CHECK_READ_BUFFER (data , NULL )
456456 return read_str_internal (data );
457457}
@@ -506,14 +506,14 @@ write_str_internal(PyObject *data, PyObject *value) {
506506}
507507
508508static PyObject *
509- write_str (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
510- static const char * const kwlist [] = {"data" , "value" , 0 };
511- static CPyArg_Parser parser = {"OO:write_str" , kwlist , 0 };
512- PyObject * data ;
513- PyObject * value ;
514- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
509+ write_str (PyObject * self , PyObject * const * args , size_t nargs ) {
510+ if (unlikely (nargs != 2 )) {
511+ PyErr_Format (PyExc_TypeError ,
512+ "write_str() takes exactly 2 arguments (%zu given)" , nargs );
515513 return NULL ;
516514 }
515+ PyObject * data = args [0 ];
516+ PyObject * value = args [1 ];
517517 _CHECK_WRITE_BUFFER (data , NULL )
518518 if (unlikely (!PyUnicode_Check (value ))) {
519519 PyErr_SetString (PyExc_TypeError , "value must be a str" );
@@ -561,13 +561,13 @@ read_bytes_internal(PyObject *data) {
561561}
562562
563563static PyObject *
564- read_bytes (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
565- static const char * const kwlist [] = {"data" , 0 };
566- static CPyArg_Parser parser = {"O:read_bytes" , kwlist , 0 };
567- PyObject * data ;
568- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
564+ read_bytes (PyObject * self , PyObject * const * args , size_t nargs ) {
565+ if (unlikely (nargs != 1 )) {
566+ PyErr_Format (PyExc_TypeError ,
567+ "read_bytes() takes exactly 1 argument (%zu given)" , nargs );
569568 return NULL ;
570569 }
570+ PyObject * data = args [0 ];
571571 _CHECK_READ_BUFFER (data , NULL )
572572 return read_bytes_internal (data );
573573}
@@ -596,14 +596,14 @@ write_bytes_internal(PyObject *data, PyObject *value) {
596596}
597597
598598static PyObject *
599- write_bytes (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
600- static const char * const kwlist [] = {"data" , "value" , 0 };
601- static CPyArg_Parser parser = {"OO:write_bytes" , kwlist , 0 };
602- PyObject * data ;
603- PyObject * value ;
604- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
599+ write_bytes (PyObject * self , PyObject * const * args , size_t nargs ) {
600+ if (unlikely (nargs != 2 )) {
601+ PyErr_Format (PyExc_TypeError ,
602+ "write_bytes() takes exactly 2 arguments (%zu given)" , nargs );
605603 return NULL ;
606604 }
605+ PyObject * data = args [0 ];
606+ PyObject * value = args [1 ];
607607 _CHECK_WRITE_BUFFER (data , NULL )
608608 if (unlikely (!PyBytes_Check (value ))) {
609609 PyErr_SetString (PyExc_TypeError , "value must be a bytes object" );
@@ -633,13 +633,13 @@ read_float_internal(PyObject *data) {
633633}
634634
635635static PyObject *
636- read_float (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
637- static const char * const kwlist [] = {"data" , 0 };
638- static CPyArg_Parser parser = {"O:read_float" , kwlist , 0 };
639- PyObject * data ;
640- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
636+ read_float (PyObject * self , PyObject * const * args , size_t nargs ) {
637+ if (unlikely (nargs != 1 )) {
638+ PyErr_Format (PyExc_TypeError ,
639+ "read_float() takes exactly 1 argument (%zu given)" , nargs );
641640 return NULL ;
642641 }
642+ PyObject * data = args [0 ];
643643 _CHECK_READ_BUFFER (data , NULL )
644644 double retval = read_float_internal (data );
645645 if (unlikely (retval == CPY_FLOAT_ERROR && PyErr_Occurred ())) {
@@ -660,14 +660,14 @@ write_float_internal(PyObject *data, double value) {
660660}
661661
662662static PyObject *
663- write_float (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
664- static const char * const kwlist [] = {"data" , "value" , 0 };
665- static CPyArg_Parser parser = {"OO:write_float" , kwlist , 0 };
666- PyObject * data ;
667- PyObject * value ;
668- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
663+ write_float (PyObject * self , PyObject * const * args , size_t nargs ) {
664+ if (unlikely (nargs != 2 )) {
665+ PyErr_Format (PyExc_TypeError ,
666+ "write_float() takes exactly 2 arguments (%zu given)" , nargs );
669667 return NULL ;
670668 }
669+ PyObject * data = args [0 ];
670+ PyObject * value = args [1 ];
671671 _CHECK_WRITE_BUFFER (data , NULL )
672672 if (unlikely (!PyFloat_Check (value ))) {
673673 PyErr_SetString (PyExc_TypeError , "value must be a float" );
@@ -735,13 +735,13 @@ read_int_internal(PyObject *data) {
735735}
736736
737737static PyObject *
738- read_int (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
739- static const char * const kwlist [] = {"data" , 0 };
740- static CPyArg_Parser parser = {"O:read_int" , kwlist , 0 };
741- PyObject * data ;
742- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
738+ read_int (PyObject * self , PyObject * const * args , size_t nargs ) {
739+ if (unlikely (nargs != 1 )) {
740+ PyErr_Format (PyExc_TypeError ,
741+ "read_int() takes exactly 1 argument (%zu given)" , nargs );
743742 return NULL ;
744743 }
744+ PyObject * data = args [0 ];
745745 _CHECK_READ_BUFFER (data , NULL )
746746 CPyTagged retval = read_int_internal (data );
747747 if (unlikely (retval == CPY_INT_TAG )) {
@@ -841,14 +841,14 @@ write_int_internal(PyObject *data, CPyTagged value) {
841841}
842842
843843static PyObject *
844- write_int (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
845- static const char * const kwlist [] = {"data" , "value" , 0 };
846- static CPyArg_Parser parser = {"OO:write_int" , kwlist , 0 };
847- PyObject * data ;
848- PyObject * value ;
849- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
844+ write_int (PyObject * self , PyObject * const * args , size_t nargs ) {
845+ if (unlikely (nargs != 2 )) {
846+ PyErr_Format (PyExc_TypeError ,
847+ "write_int() takes exactly 2 arguments (%zu given)" , nargs );
850848 return NULL ;
851849 }
850+ PyObject * data = args [0 ];
851+ PyObject * value = args [1 ];
852852 _CHECK_WRITE_BUFFER (data , NULL )
853853 if (unlikely (!PyLong_Check (value ))) {
854854 PyErr_SetString (PyExc_TypeError , "value must be an int" );
@@ -876,13 +876,13 @@ read_tag_internal(PyObject *data) {
876876}
877877
878878static PyObject *
879- read_tag (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
880- static const char * const kwlist [] = {"data" , 0 };
881- static CPyArg_Parser parser = {"O:read_tag" , kwlist , 0 };
882- PyObject * data ;
883- if (unlikely (!CPyArg_ParseStackAndKeywordsOneArg (args , nargs , kwnames , & parser , & data ))) {
879+ read_tag (PyObject * self , PyObject * const * args , size_t nargs ) {
880+ if (unlikely (nargs != 1 )) {
881+ PyErr_Format (PyExc_TypeError ,
882+ "read_tag() takes exactly 1 argument (%zu given)" , nargs );
884883 return NULL ;
885884 }
885+ PyObject * data = args [0 ];
886886 _CHECK_READ_BUFFER (data , NULL )
887887 uint8_t retval = read_tag_internal (data );
888888 if (unlikely (retval == CPY_LL_UINT_ERROR && PyErr_Occurred ())) {
@@ -899,14 +899,14 @@ write_tag_internal(PyObject *data, uint8_t value) {
899899}
900900
901901static PyObject *
902- write_tag (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
903- static const char * const kwlist [] = {"data" , "value" , 0 };
904- static CPyArg_Parser parser = {"OO:write_tag" , kwlist , 0 };
905- PyObject * data ;
906- PyObject * value ;
907- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & data , & value ))) {
902+ write_tag (PyObject * self , PyObject * const * args , size_t nargs ) {
903+ if (unlikely (nargs != 2 )) {
904+ PyErr_Format (PyExc_TypeError ,
905+ "write_tag() takes exactly 2 arguments (%zu given)" , nargs );
908906 return NULL ;
909907 }
908+ PyObject * data = args [0 ];
909+ PyObject * value = args [1 ];
910910 _CHECK_WRITE_BUFFER (data , NULL )
911911 uint8_t unboxed = CPyLong_AsUInt8 (value );
912912 if (unlikely (unboxed == CPY_LL_UINT_ERROR && PyErr_Occurred ())) {
@@ -941,18 +941,18 @@ WriteBuffer_type_internal(void) {
941941};
942942
943943static PyMethodDef librt_internal_module_methods [] = {
944- {"write_bool" , (PyCFunction )write_bool , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write a bool" )},
945- {"read_bool" , (PyCFunction )read_bool , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read a bool" )},
946- {"write_str" , (PyCFunction )write_str , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write a string" )},
947- {"read_str" , (PyCFunction )read_str , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read a string" )},
948- {"write_bytes" , (PyCFunction )write_bytes , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write bytes" )},
949- {"read_bytes" , (PyCFunction )read_bytes , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read bytes" )},
950- {"write_float" , (PyCFunction )write_float , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write a float" )},
951- {"read_float" , (PyCFunction )read_float , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read a float" )},
952- {"write_int" , (PyCFunction )write_int , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write an int" )},
953- {"read_int" , (PyCFunction )read_int , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read an int" )},
954- {"write_tag" , (PyCFunction )write_tag , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("write a short int" )},
955- {"read_tag" , (PyCFunction )read_tag , METH_FASTCALL | METH_KEYWORDS , PyDoc_STR ("read a short int" )},
944+ {"write_bool" , (PyCFunction )write_bool , METH_FASTCALL , PyDoc_STR ("write a bool" )},
945+ {"read_bool" , (PyCFunction )read_bool , METH_FASTCALL , PyDoc_STR ("read a bool" )},
946+ {"write_str" , (PyCFunction )write_str , METH_FASTCALL , PyDoc_STR ("write a string" )},
947+ {"read_str" , (PyCFunction )read_str , METH_FASTCALL , PyDoc_STR ("read a string" )},
948+ {"write_bytes" , (PyCFunction )write_bytes , METH_FASTCALL , PyDoc_STR ("write bytes" )},
949+ {"read_bytes" , (PyCFunction )read_bytes , METH_FASTCALL , PyDoc_STR ("read bytes" )},
950+ {"write_float" , (PyCFunction )write_float , METH_FASTCALL , PyDoc_STR ("write a float" )},
951+ {"read_float" , (PyCFunction )read_float , METH_FASTCALL , PyDoc_STR ("read a float" )},
952+ {"write_int" , (PyCFunction )write_int , METH_FASTCALL , PyDoc_STR ("write an int" )},
953+ {"read_int" , (PyCFunction )read_int , METH_FASTCALL , PyDoc_STR ("read an int" )},
954+ {"write_tag" , (PyCFunction )write_tag , METH_FASTCALL , PyDoc_STR ("write a short int" )},
955+ {"read_tag" , (PyCFunction )read_tag , METH_FASTCALL , PyDoc_STR ("read a short int" )},
956956 {"cache_version" , (PyCFunction )cache_version , METH_NOARGS , PyDoc_STR ("cache format version" )},
957957 {NULL , NULL , 0 , NULL }
958958};
0 commit comments