@@ -200,14 +200,14 @@ static PySequenceMethods BytesWriter_as_sequence = {
200200};
201201
202202static PyObject * BytesWriter_append (PyObject * self , PyObject * const * args , size_t nargs );
203- static PyObject * BytesWriter_write (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames );
203+ static PyObject * BytesWriter_write (PyObject * self , PyObject * const * args , size_t nargs );
204204static PyObject * BytesWriter_truncate (PyObject * self , PyObject * const * args , size_t nargs );
205205
206206static PyMethodDef BytesWriter_methods [] = {
207207 {"append" , (PyCFunction ) BytesWriter_append , METH_FASTCALL ,
208208 PyDoc_STR ("Append a single byte to the buffer" )
209209 },
210- {"write" , (PyCFunction ) BytesWriter_write , METH_FASTCALL | METH_KEYWORDS ,
210+ {"write" , (PyCFunction ) BytesWriter_write , METH_FASTCALL ,
211211 PyDoc_STR ("Append bytes to the buffer" )
212212 },
213213 {"getvalue" , (PyCFunction ) BytesWriter_getvalue , METH_NOARGS ,
@@ -265,16 +265,16 @@ BytesWriter_write_internal(BytesWriterObject *self, PyObject *value) {
265265}
266266
267267static PyObject *
268- BytesWriter_write (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
269- static const char * const kwlist [] = {"value" , 0 };
270- static CPyArg_Parser parser = {"O:write" , kwlist , 0 };
271- PyObject * value ;
272- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & value ))) {
268+ BytesWriter_write (PyObject * self , PyObject * const * args , size_t nargs ) {
269+ if (unlikely (nargs != 1 )) {
270+ PyErr_Format (PyExc_TypeError ,
271+ "write() takes exactly 1 argument (%zu given)" , nargs );
273272 return NULL ;
274273 }
275274 if (!check_bytes_writer (self )) {
276275 return NULL ;
277276 }
277+ PyObject * value = args [0 ];
278278 if (unlikely (!PyBytes_Check (value ) && !PyByteArray_Check (value ))) {
279279 PyErr_SetString (PyExc_TypeError , "value must be a bytes or bytearray object" );
280280 return NULL ;
@@ -574,14 +574,14 @@ static PySequenceMethods StringWriter_as_sequence = {
574574 .sq_item = (ssizeargfunc )StringWriter_item ,
575575};
576576
577- static PyObject * StringWriter_append (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames );
578- static PyObject * StringWriter_write (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames );
577+ static PyObject * StringWriter_append (PyObject * self , PyObject * const * args , size_t nargs );
578+ static PyObject * StringWriter_write (PyObject * self , PyObject * const * args , size_t nargs );
579579
580580static PyMethodDef StringWriter_methods [] = {
581- {"append" , (PyCFunction ) StringWriter_append , METH_FASTCALL | METH_KEYWORDS ,
581+ {"append" , (PyCFunction ) StringWriter_append , METH_FASTCALL ,
582582 PyDoc_STR ("Append a single character (as int codepoint) to the buffer" )
583583 },
584- {"write" , (PyCFunction ) StringWriter_write , METH_FASTCALL | METH_KEYWORDS ,
584+ {"write" , (PyCFunction ) StringWriter_write , METH_FASTCALL ,
585585 PyDoc_STR ("Append a string to the buffer" )
586586 },
587587 {"getvalue" , (PyCFunction ) StringWriter_getvalue , METH_NOARGS ,
@@ -661,16 +661,16 @@ StringWriter_write_internal(StringWriterObject *self, PyObject *value) {
661661}
662662
663663static PyObject *
664- StringWriter_write (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
665- static const char * const kwlist [] = {"value" , 0 };
666- static CPyArg_Parser parser = {"O:write" , kwlist , 0 };
667- PyObject * value ;
668- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & value ))) {
664+ StringWriter_write (PyObject * self , PyObject * const * args , size_t nargs ) {
665+ if (unlikely (nargs != 1 )) {
666+ PyErr_Format (PyExc_TypeError ,
667+ "write() takes exactly 1 argument (%zu given)" , nargs );
669668 return NULL ;
670669 }
671670 if (!check_string_writer (self )) {
672671 return NULL ;
673672 }
673+ PyObject * value = args [0 ];
674674 if (unlikely (!PyUnicode_Check (value ))) {
675675 PyErr_SetString (PyExc_TypeError , "value must be a str object" );
676676 return NULL ;
@@ -795,16 +795,16 @@ StringWriter_append_internal(StringWriterObject *self, int32_t value) {
795795}
796796
797797static PyObject *
798- StringWriter_append (PyObject * self , PyObject * const * args , size_t nargs , PyObject * kwnames ) {
799- static const char * const kwlist [] = {"value" , 0 };
800- static CPyArg_Parser parser = {"O:append" , kwlist , 0 };
801- PyObject * value ;
802- if (unlikely (!CPyArg_ParseStackAndKeywordsSimple (args , nargs , kwnames , & parser , & value ))) {
798+ StringWriter_append (PyObject * self , PyObject * const * args , size_t nargs ) {
799+ if (unlikely (nargs != 1 )) {
800+ PyErr_Format (PyExc_TypeError ,
801+ "append() takes exactly 1 argument (%zu given)" , nargs );
803802 return NULL ;
804803 }
805804 if (!check_string_writer (self )) {
806805 return NULL ;
807806 }
807+ PyObject * value = args [0 ];
808808 int32_t unboxed = CPyLong_AsInt32 (value );
809809 if (unlikely (unboxed == CPY_LL_INT_ERROR && PyErr_Occurred ())) {
810810 CPy_TypeError ("i32" , value );
0 commit comments