@@ -89,13 +89,15 @@ a ValueError. Other possible values are 'ignore', 'replace' and\n\
8989codecs.register_error that can handle ValueErrors." );
9090
9191static PyObject *
92- codec_encode (PyObject * self , PyObject * args )
92+ codec_encode (PyObject * self , PyObject * args , PyObject * kwargs )
9393{
94+ static char * kwlist [] = {"obj" , "encoding" , "errors" , NULL };
9495 const char * encoding = NULL ;
9596 const char * errors = NULL ;
9697 PyObject * v ;
9798
98- if (!PyArg_ParseTuple (args , "O|ss:encode" , & v , & encoding , & errors ))
99+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "O|ss:encode" , kwlist ,
100+ & v , & encoding , & errors ))
99101 return NULL ;
100102
101103 if (encoding == NULL )
@@ -116,13 +118,15 @@ as well as any other name registered with codecs.register_error that is\n\
116118able to handle ValueErrors." );
117119
118120static PyObject *
119- codec_decode (PyObject * self , PyObject * args )
121+ codec_decode (PyObject * self , PyObject * args , PyObject * kwargs )
120122{
123+ static char * kwlist [] = {"obj" , "encoding" , "errors" , NULL };
121124 const char * encoding = NULL ;
122125 const char * errors = NULL ;
123126 PyObject * v ;
124127
125- if (!PyArg_ParseTuple (args , "O|ss:decode" , & v , & encoding , & errors ))
128+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "O|ss:decode" , kwlist ,
129+ & v , & encoding , & errors ))
126130 return NULL ;
127131
128132 if (encoding == NULL )
@@ -1120,9 +1124,9 @@ static PyMethodDef _codecs_functions[] = {
11201124 register__doc__ },
11211125 {"lookup" , codec_lookup , METH_VARARGS ,
11221126 lookup__doc__ },
1123- {"encode" , codec_encode , METH_VARARGS ,
1127+ {"encode" , ( PyCFunction ) codec_encode , METH_VARARGS | METH_KEYWORDS ,
11241128 encode__doc__ },
1125- {"decode" , codec_decode , METH_VARARGS ,
1129+ {"decode" , ( PyCFunction ) codec_decode , METH_VARARGS | METH_KEYWORDS ,
11261130 decode__doc__ },
11271131 {"escape_encode" , escape_encode , METH_VARARGS },
11281132 {"escape_decode" , escape_decode , METH_VARARGS },
0 commit comments