mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-25007: Add copy protocol support to zlib compressors and decompressors (GH-7940)
This commit is contained in:
parent
fbd7172325
commit
d2cbfffc84
5 changed files with 183 additions and 25 deletions
84
Modules/clinic/zlibmodule.c.h
generated
84
Modules/clinic/zlibmodule.c.h
generated
|
@ -335,6 +335,39 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
|
|||
|
||||
#if defined(HAVE_ZLIB_COPY)
|
||||
|
||||
PyDoc_STRVAR(zlib_Compress___copy____doc__,
|
||||
"__copy__($self, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define ZLIB_COMPRESS___COPY___METHODDEF \
|
||||
{"__copy__", (PyCFunction)zlib_Compress___copy__, METH_NOARGS, zlib_Compress___copy____doc__},
|
||||
|
||||
static PyObject *
|
||||
zlib_Compress___copy___impl(compobject *self);
|
||||
|
||||
static PyObject *
|
||||
zlib_Compress___copy__(compobject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return zlib_Compress___copy___impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_ZLIB_COPY) */
|
||||
|
||||
#if defined(HAVE_ZLIB_COPY)
|
||||
|
||||
PyDoc_STRVAR(zlib_Compress___deepcopy____doc__,
|
||||
"__deepcopy__($self, memo, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define ZLIB_COMPRESS___DEEPCOPY___METHODDEF \
|
||||
{"__deepcopy__", (PyCFunction)zlib_Compress___deepcopy__, METH_O, zlib_Compress___deepcopy____doc__},
|
||||
|
||||
#endif /* defined(HAVE_ZLIB_COPY) */
|
||||
|
||||
#if defined(HAVE_ZLIB_COPY)
|
||||
|
||||
PyDoc_STRVAR(zlib_Decompress_copy__doc__,
|
||||
"copy($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -355,6 +388,39 @@ zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
|
|||
|
||||
#endif /* defined(HAVE_ZLIB_COPY) */
|
||||
|
||||
#if defined(HAVE_ZLIB_COPY)
|
||||
|
||||
PyDoc_STRVAR(zlib_Decompress___copy____doc__,
|
||||
"__copy__($self, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define ZLIB_DECOMPRESS___COPY___METHODDEF \
|
||||
{"__copy__", (PyCFunction)zlib_Decompress___copy__, METH_NOARGS, zlib_Decompress___copy____doc__},
|
||||
|
||||
static PyObject *
|
||||
zlib_Decompress___copy___impl(compobject *self);
|
||||
|
||||
static PyObject *
|
||||
zlib_Decompress___copy__(compobject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return zlib_Decompress___copy___impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(HAVE_ZLIB_COPY) */
|
||||
|
||||
#if defined(HAVE_ZLIB_COPY)
|
||||
|
||||
PyDoc_STRVAR(zlib_Decompress___deepcopy____doc__,
|
||||
"__deepcopy__($self, memo, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF \
|
||||
{"__deepcopy__", (PyCFunction)zlib_Decompress___deepcopy__, METH_O, zlib_Decompress___deepcopy____doc__},
|
||||
|
||||
#endif /* defined(HAVE_ZLIB_COPY) */
|
||||
|
||||
PyDoc_STRVAR(zlib_Decompress_flush__doc__,
|
||||
"flush($self, length=zlib.DEF_BUF_SIZE, /)\n"
|
||||
"--\n"
|
||||
|
@ -468,7 +534,23 @@ exit:
|
|||
#define ZLIB_COMPRESS_COPY_METHODDEF
|
||||
#endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */
|
||||
|
||||
#ifndef ZLIB_COMPRESS___COPY___METHODDEF
|
||||
#define ZLIB_COMPRESS___COPY___METHODDEF
|
||||
#endif /* !defined(ZLIB_COMPRESS___COPY___METHODDEF) */
|
||||
|
||||
#ifndef ZLIB_COMPRESS___DEEPCOPY___METHODDEF
|
||||
#define ZLIB_COMPRESS___DEEPCOPY___METHODDEF
|
||||
#endif /* !defined(ZLIB_COMPRESS___DEEPCOPY___METHODDEF) */
|
||||
|
||||
#ifndef ZLIB_DECOMPRESS_COPY_METHODDEF
|
||||
#define ZLIB_DECOMPRESS_COPY_METHODDEF
|
||||
#endif /* !defined(ZLIB_DECOMPRESS_COPY_METHODDEF) */
|
||||
/*[clinic end generated code: output=43dd29b8977765f9 input=a9049054013a1b77]*/
|
||||
|
||||
#ifndef ZLIB_DECOMPRESS___COPY___METHODDEF
|
||||
#define ZLIB_DECOMPRESS___COPY___METHODDEF
|
||||
#endif /* !defined(ZLIB_DECOMPRESS___COPY___METHODDEF) */
|
||||
|
||||
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
|
||||
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
|
||||
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
|
||||
/*[clinic end generated code: output=d46c646770146ade input=a9049054013a1b77]*/
|
||||
|
|
|
@ -984,6 +984,32 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
zlib.Compress.__copy__
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
zlib_Compress___copy___impl(compobject *self)
|
||||
/*[clinic end generated code: output=1875e6791975442e input=be97a05a788dfd83]*/
|
||||
{
|
||||
return zlib_Compress_copy_impl(self);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
zlib.Compress.__deepcopy__
|
||||
|
||||
memo: object
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
zlib_Compress___deepcopy__(compobject *self, PyObject *memo)
|
||||
/*[clinic end generated code: output=f47a2213282c9eb0 input=a9a8b0b40d83388e]*/
|
||||
{
|
||||
return zlib_Compress_copy_impl(self);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
zlib.Decompress.copy
|
||||
|
||||
|
@ -1039,6 +1065,33 @@ error:
|
|||
Py_XDECREF(retval);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
zlib.Decompress.__copy__
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
zlib_Decompress___copy___impl(compobject *self)
|
||||
/*[clinic end generated code: output=80bae8bc43498ad4 input=efcb98b5472c13d2]*/
|
||||
{
|
||||
return zlib_Decompress_copy_impl(self);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
zlib.Decompress.__deepcopy__
|
||||
|
||||
memo: object
|
||||
/
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
zlib_Decompress___deepcopy__(compobject *self, PyObject *memo)
|
||||
/*[clinic end generated code: output=1f77286ab490124b input=6e99bd0ac4b9cd8b]*/
|
||||
{
|
||||
return zlib_Decompress_copy_impl(self);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*[clinic input]
|
||||
|
@ -1139,6 +1192,8 @@ static PyMethodDef comp_methods[] =
|
|||
ZLIB_COMPRESS_COMPRESS_METHODDEF
|
||||
ZLIB_COMPRESS_FLUSH_METHODDEF
|
||||
ZLIB_COMPRESS_COPY_METHODDEF
|
||||
ZLIB_COMPRESS___COPY___METHODDEF
|
||||
ZLIB_COMPRESS___DEEPCOPY___METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -1147,6 +1202,8 @@ static PyMethodDef Decomp_methods[] =
|
|||
ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF
|
||||
ZLIB_DECOMPRESS_FLUSH_METHODDEF
|
||||
ZLIB_DECOMPRESS_COPY_METHODDEF
|
||||
ZLIB_DECOMPRESS___COPY___METHODDEF
|
||||
ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue