return return_value;
}
-PyDoc_STRVAR(zlib_ZlibDecompressor_decompress__doc__,
+PyDoc_STRVAR(zlib__ZlibDecompressor_decompress__doc__,
"decompress($self, /, data, max_length=-1)\n"
"--\n"
"\n"
"EOFError. Any data found after the end of the stream is ignored and saved in\n"
"the unused_data attribute.");
-#define ZLIB_ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF \
- {"decompress", _PyCFunction_CAST(zlib_ZlibDecompressor_decompress), METH_FASTCALL|METH_KEYWORDS, zlib_ZlibDecompressor_decompress__doc__},
+#define ZLIB__ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF \
+ {"decompress", _PyCFunction_CAST(zlib__ZlibDecompressor_decompress), METH_FASTCALL|METH_KEYWORDS, zlib__ZlibDecompressor_decompress__doc__},
static PyObject *
-zlib_ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
- Py_buffer *data, Py_ssize_t max_length);
+zlib__ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
+ Py_buffer *data,
+ Py_ssize_t max_length);
static PyObject *
-zlib_ZlibDecompressor_decompress(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+zlib__ZlibDecompressor_decompress(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
max_length = ival;
}
skip_optional_pos:
- return_value = zlib_ZlibDecompressor_decompress_impl((ZlibDecompressor *)self, &data, max_length);
+ return_value = zlib__ZlibDecompressor_decompress_impl((ZlibDecompressor *)self, &data, max_length);
exit:
/* Cleanup for data */
return return_value;
}
+PyDoc_STRVAR(zlib__ZlibDecompressor__doc__,
+"_ZlibDecompressor(wbits=MAX_WBITS, zdict=b\'\')\n"
+"--\n"
+"\n"
+"Create a decompressor object for decompressing data incrementally.\n"
+"\n"
+" zdict\n"
+" The predefined compression dictionary. This is a sequence of bytes\n"
+" (such as a bytes object) containing subsequences that are expected\n"
+" to occur frequently in the data that is to be compressed. Those\n"
+" subsequences that are expected to be most common should come at the\n"
+" end of the dictionary. This must be the same dictionary as used by the\n"
+" compressor that produced the input data.");
+
+static PyObject *
+zlib__ZlibDecompressor_impl(PyTypeObject *type, int wbits, PyObject *zdict);
+
+static PyObject *
+zlib__ZlibDecompressor(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+
+ #define NUM_KEYWORDS 2
+ static struct {
+ PyGC_Head _this_is_not_used;
+ PyObject_VAR_HEAD
+ Py_hash_t ob_hash;
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_hash = -1,
+ .ob_item = { &_Py_ID(wbits), &_Py_ID(zdict), },
+ };
+ #undef NUM_KEYWORDS
+ #define KWTUPLE (&_kwtuple.ob_base.ob_base)
+
+ #else // !Py_BUILD_CORE
+ # define KWTUPLE NULL
+ #endif // !Py_BUILD_CORE
+
+ static const char * const _keywords[] = {"wbits", "zdict", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "_ZlibDecompressor",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
+ int wbits = MAX_WBITS;
+ PyObject *zdict = NULL;
+
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser,
+ /*minpos*/ 0, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[0]) {
+ wbits = PyLong_AsInt(fastargs[0]);
+ if (wbits == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
+ zdict = fastargs[1];
+skip_optional_pos:
+ return_value = zlib__ZlibDecompressor_impl(type, wbits, zdict);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(zlib_adler32__doc__,
"adler32($module, data, value=1, /)\n"
"--\n"
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=3054c8894aa44568 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=59184b81fea41d3d input=a9049054013a1b77]*/
} ZlibDecompressor;
/*[clinic input]
-class zlib.ZlibDecompressor "ZlibDecompressor *" "&ZlibDecompressorType"
+class zlib._ZlibDecompressor "ZlibDecompressor *" "&ZlibDecompressorType"
[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0658178ab94645df]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=49151d1d703e6bcc]*/
static void
ZlibDecompressor_dealloc(PyObject *op)
/*[clinic input]
@permit_long_docstring_body
-zlib.ZlibDecompressor.decompress
+zlib._ZlibDecompressor.decompress
data: Py_buffer
max_length: Py_ssize_t=-1
[clinic start generated code]*/
static PyObject *
-zlib_ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
- Py_buffer *data, Py_ssize_t max_length)
-/*[clinic end generated code: output=990d32787b775f85 input=fcf9f974de5d02b1]*/
+zlib__ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
+ Py_buffer *data,
+ Py_ssize_t max_length)
+/*[clinic end generated code: output=ac00dcf73e843e99 input=c9278e791be1152b]*/
{
PyObject *result = NULL;
return result;
}
-PyDoc_STRVAR(ZlibDecompressor__new____doc__,
-"_ZlibDecompressor(wbits=15, zdict=b\'\')\n"
-"--\n"
-"\n"
-"Create a decompressor object for decompressing data incrementally.\n"
-"\n"
-" wbits = 15\n"
-" zdict\n"
-" The predefined compression dictionary. This is a sequence of bytes\n"
-" (such as a bytes object) containing subsequences that are expected\n"
-" to occur frequently in the data that is to be compressed. Those\n"
-" subsequences that are expected to be most common should come at the\n"
-" end of the dictionary. This must be the same dictionary as used by the\n"
-" compressor that produced the input data.\n"
-"\n");
+/*[clinic input]
+@classmethod
+zlib._ZlibDecompressor.__new__
+
+ wbits: int(c_default='MAX_WBITS') = MAX_WBITS
+ zdict: object(c_default='NULL') = b''
+ The predefined compression dictionary. This is a sequence of bytes
+ (such as a bytes object) containing subsequences that are expected
+ to occur frequently in the data that is to be compressed. Those
+ subsequences that are expected to be most common should come at the
+ end of the dictionary. This must be the same dictionary as used by the
+ compressor that produced the input data.
+
+Create a decompressor object for decompressing data incrementally.
+[clinic start generated code]*/
static PyObject *
-ZlibDecompressor__new__(PyTypeObject *cls,
- PyObject *args,
- PyObject *kwargs)
+zlib__ZlibDecompressor_impl(PyTypeObject *type, int wbits, PyObject *zdict)
+/*[clinic end generated code: output=1065607df0d33baa input=9ebad0be6de226e2]*/
{
- static char *keywords[] = {"wbits", "zdict", NULL};
- static const char * const format = "|iO:_ZlibDecompressor";
- int wbits = MAX_WBITS;
- PyObject *zdict = NULL;
- zlibstate *state = PyType_GetModuleState(cls);
-
- if (!PyArg_ParseTupleAndKeywords(
- args, kwargs, format, keywords, &wbits, &zdict)) {
- return NULL;
- }
- ZlibDecompressor *self = PyObject_New(ZlibDecompressor, cls);
+ zlibstate *state = PyType_GetModuleState(type);
+ ZlibDecompressor *self = PyObject_New(ZlibDecompressor, type);
if (self == NULL) {
return NULL;
}
};
static PyMethodDef ZlibDecompressor_methods[] = {
- ZLIB_ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF
+ ZLIB__ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF
{NULL}
};
static PyType_Slot ZlibDecompressor_type_slots[] = {
{Py_tp_dealloc, ZlibDecompressor_dealloc},
{Py_tp_members, ZlibDecompressor_members},
- {Py_tp_new, ZlibDecompressor__new__},
- {Py_tp_doc, (char *)ZlibDecompressor__new____doc__},
+ {Py_tp_new, zlib__ZlibDecompressor},
+ {Py_tp_doc, (char *)zlib__ZlibDecompressor__doc__},
{Py_tp_methods, ZlibDecompressor_methods},
{0, 0},
};