-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
gh-95534: Convert ZlibDecompressor.__new__
to AC
#137923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1369,9 +1369,9 @@ typedef struct { | |
} 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) | ||
|
@@ -1670,7 +1670,7 @@ decompress(ZlibDecompressor *self, uint8_t *data, | |
|
||
/*[clinic input] | ||
@permit_long_docstring_body | ||
zlib.ZlibDecompressor.decompress | ||
zlib._ZlibDecompressor.decompress | ||
|
||
data: Py_buffer | ||
max_length: Py_ssize_t=-1 | ||
|
@@ -1692,9 +1692,10 @@ the unused_data attribute. | |
[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; | ||
|
@@ -1710,38 +1711,28 @@ zlib_ZlibDecompressor_decompress_impl(ZlibDecompressor *self, | |
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 | ||
AA-Turner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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; | ||
} | ||
|
@@ -1817,7 +1808,7 @@ static PyMethodDef Decomp_methods[] = | |
}; | ||
|
||
static PyMethodDef ZlibDecompressor_methods[] = { | ||
ZLIB_ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF | ||
ZLIB__ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF | ||
{NULL} | ||
}; | ||
|
||
|
@@ -2052,8 +2043,8 @@ static PyType_Spec Decomptype_spec = { | |
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__}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is something separate, but I think AC should give the possibility to create docstrings for |
||
{Py_tp_methods, ZlibDecompressor_methods}, | ||
{0, 0}, | ||
}; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.