diff options
Diffstat (limited to 'Modules/clinic/_bz2module.c.h')
-rw-r--r-- | Modules/clinic/_bz2module.c.h | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h index 8a201a08de..3ed8303e95 100644 --- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -14,20 +14,18 @@ PyDoc_STRVAR(_bz2_BZ2Compressor_compress__doc__, "flush() method to finish the compression process."); #define _BZ2_BZ2COMPRESSOR_COMPRESS_METHODDEF \ - {"compress", (PyCFunction)_bz2_BZ2Compressor_compress, METH_VARARGS, _bz2_BZ2Compressor_compress__doc__}, + {"compress", (PyCFunction)_bz2_BZ2Compressor_compress, METH_O, _bz2_BZ2Compressor_compress__doc__}, static PyObject * _bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data); static PyObject * -_bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *args) +_bz2_BZ2Compressor_compress(BZ2Compressor *self, PyObject *arg) { PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_ParseTuple(args, - "y*:compress", - &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) goto exit; return_value = _bz2_BZ2Compressor_compress_impl(self, &data); @@ -84,8 +82,7 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) if ((Py_TYPE(self) == &BZ2Compressor_Type) && !_PyArg_NoKeywords("BZ2Compressor", kwargs)) goto exit; - if (!PyArg_ParseTuple(args, - "|i:BZ2Compressor", + if (!PyArg_ParseTuple(args, "|i:BZ2Compressor", &compresslevel)) goto exit; return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel); @@ -95,34 +92,43 @@ exit: } PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__, -"decompress($self, data, /)\n" +"decompress($self, /, data, max_length=-1)\n" "--\n" "\n" -"Provide data to the decompressor object.\n" +"Decompress *data*, returning uncompressed data as bytes.\n" "\n" -"Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n" +"If *max_length* is nonnegative, returns at most *max_length* bytes of\n" +"decompressed data. If this limit is reached and further output can be\n" +"produced, *self.needs_input* will be set to ``False``. In this case, the next\n" +"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n" "\n" -"Attempting to decompress data after the end of stream is reached\n" -"raises an EOFError. Any data found after the end of the stream\n" -"is ignored and saved in the unused_data attribute."); +"If all of the input data was decompressed and returned (either because this\n" +"was less than *max_length* bytes, or because *max_length* was negative),\n" +"*self.needs_input* will be set to True.\n" +"\n" +"Attempting to decompress data after the end of stream is reached raises an\n" +"EOFError. Any data found after the end of the stream is ignored and saved in\n" +"the unused_data attribute."); #define _BZ2_BZ2DECOMPRESSOR_DECOMPRESS_METHODDEF \ - {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_VARARGS, _bz2_BZ2Decompressor_decompress__doc__}, + {"decompress", (PyCFunction)_bz2_BZ2Decompressor_decompress, METH_VARARGS|METH_KEYWORDS, _bz2_BZ2Decompressor_decompress__doc__}, static PyObject * -_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data); +_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data, + Py_ssize_t max_length); static PyObject * -_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args) +_bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static char *_keywords[] = {"data", "max_length", NULL}; Py_buffer data = {NULL, NULL}; + Py_ssize_t max_length = -1; - if (!PyArg_ParseTuple(args, - "y*:decompress", - &data)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords, + &data, &max_length)) goto exit; - return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data); + return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ @@ -159,4 +165,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=21ca4405519a0931 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fef29b76b3314fc7 input=a9049054013a1b77]*/ |