@@ -3,38 +3,39 @@ preserve
33[clinic start generated code]*/
44
55PyDoc_STRVAR (zlib_compress__doc__ ,
6- "compress($module, bytes, level=Z_DEFAULT_COMPRESSION, / )\n"
6+ "compress($module, /, data, level=Z_DEFAULT_COMPRESSION)\n"
77"--\n"
88"\n"
99"Returns a bytes object containing compressed data.\n"
1010"\n"
11- " bytes \n"
11+ " data \n"
1212" Binary data to be compressed.\n"
1313" level\n"
1414" Compression level, in 0-9." );
1515
1616#define ZLIB_COMPRESS_METHODDEF \
17- {"compress", (PyCFunction)zlib_compress, METH_VARARGS, zlib_compress__doc__},
17+ {"compress", (PyCFunction)zlib_compress, METH_VARARGS|METH_KEYWORDS , zlib_compress__doc__},
1818
1919static PyObject *
20- zlib_compress_impl (PyModuleDef * module , Py_buffer * bytes , int level );
20+ zlib_compress_impl (PyModuleDef * module , Py_buffer * data , int level );
2121
2222static PyObject *
23- zlib_compress (PyModuleDef * module , PyObject * args )
23+ zlib_compress (PyModuleDef * module , PyObject * args , PyObject * kwargs )
2424{
2525 PyObject * return_value = NULL ;
26- Py_buffer bytes = {NULL , NULL };
26+ static char * _keywords [] = {"data" , "level" , NULL };
27+ Py_buffer data = {NULL , NULL };
2728 int level = Z_DEFAULT_COMPRESSION ;
2829
29- if (!PyArg_ParseTuple (args , "y*|i:compress" ,
30- & bytes , & level ))
30+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "y*|i:compress" , _keywords ,
31+ & data , & level ))
3132 goto exit ;
32- return_value = zlib_compress_impl (module , & bytes , level );
33+ return_value = zlib_compress_impl (module , & data , level );
3334
3435exit :
35- /* Cleanup for bytes */
36- if (bytes .obj )
37- PyBuffer_Release (& bytes );
36+ /* Cleanup for data */
37+ if (data .obj )
38+ PyBuffer_Release (& data );
3839
3940 return return_value ;
4041}
@@ -439,4 +440,4 @@ zlib_crc32(PyModuleDef *module, PyObject *args)
439440#ifndef ZLIB_COMPRESS_COPY_METHODDEF
440441 #define ZLIB_COMPRESS_COPY_METHODDEF
441442#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
442- /*[clinic end generated code: output=cf81e1deae3af0ce input=a9049054013a1b77]*/
443+ /*[clinic end generated code: output=3c96b58b923c1273 input=a9049054013a1b77]*/
0 commit comments