bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)

This commit is contained in:
Serhiy Storchaka 2019-03-14 10:32:22 +02:00 committed by GitHub
parent 2c0d3f4547
commit 3191391515
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 7466 additions and 868 deletions

View file

@ -22,7 +22,11 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL};
static _PyArg_Parser _parser = {"|O$iy*y*y*iiO&O&iip:blake2b", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "blake2b", 0};
PyObject *argsbuf[12];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *data = NULL;
int digest_size = BLAKE2B_OUTBYTES;
Py_buffer key = {NULL, NULL};
@ -36,10 +40,146 @@ py_blake2b_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
int inner_size = 0;
int last_node = 0;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&data, &digest_size, &key, &salt, &person, &fanout, &depth, _PyLong_UnsignedLong_Converter, &leaf_size, _PyLong_UnsignedLongLong_Converter, &node_offset, &node_depth, &inner_size, &last_node)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (nargs < 1) {
goto skip_optional_posonly;
}
noptargs--;
data = fastargs[0];
skip_optional_posonly:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (fastargs[1]) {
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
digest_size = _PyLong_AsInt(fastargs[1]);
if (digest_size == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[2]) {
if (PyObject_GetBuffer(fastargs[2], &key, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&key, 'C')) {
_PyArg_BadArgument("blake2b", 3, "contiguous buffer", fastargs[2]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[3]) {
if (PyObject_GetBuffer(fastargs[3], &salt, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&salt, 'C')) {
_PyArg_BadArgument("blake2b", 4, "contiguous buffer", fastargs[3]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[4]) {
if (PyObject_GetBuffer(fastargs[4], &person, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&person, 'C')) {
_PyArg_BadArgument("blake2b", 5, "contiguous buffer", fastargs[4]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[5]) {
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[6]) {
if (PyFloat_Check(fastargs[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[7]) {
if (!_PyLong_UnsignedLong_Converter(fastargs[7], &leaf_size)) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[8]) {
if (!_PyLong_UnsignedLongLong_Converter(fastargs[8], &node_offset)) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[9]) {
if (PyFloat_Check(fastargs[9])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
node_depth = _PyLong_AsInt(fastargs[9]);
if (node_depth == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[10]) {
if (PyFloat_Check(fastargs[10])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
inner_size = _PyLong_AsInt(fastargs[10]);
if (inner_size == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
last_node = PyObject_IsTrue(fastargs[11]);
if (last_node < 0) {
goto exit;
}
skip_optional_kwonly:
return_value = py_blake2b_new_impl(type, data, digest_size, &key, &salt, &person, fanout, depth, leaf_size, node_offset, node_depth, inner_size, last_node);
exit:
@ -121,4 +261,4 @@ _blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
{
return _blake2_blake2b_hexdigest_impl(self);
}
/*[clinic end generated code: output=39c77de2142faa12 input=a9049054013a1b77]*/
/*[clinic end generated code: output=a91d182ce1109f34 input=a9049054013a1b77]*/

View file

@ -22,7 +22,11 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "digest_size", "key", "salt", "person", "fanout", "depth", "leaf_size", "node_offset", "node_depth", "inner_size", "last_node", NULL};
static _PyArg_Parser _parser = {"|O$iy*y*y*iiO&O&iip:blake2s", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "blake2s", 0};
PyObject *argsbuf[12];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *data = NULL;
int digest_size = BLAKE2S_OUTBYTES;
Py_buffer key = {NULL, NULL};
@ -36,10 +40,146 @@ py_blake2s_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
int inner_size = 0;
int last_node = 0;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&data, &digest_size, &key, &salt, &person, &fanout, &depth, _PyLong_UnsignedLong_Converter, &leaf_size, _PyLong_UnsignedLongLong_Converter, &node_offset, &node_depth, &inner_size, &last_node)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (nargs < 1) {
goto skip_optional_posonly;
}
noptargs--;
data = fastargs[0];
skip_optional_posonly:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (fastargs[1]) {
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
digest_size = _PyLong_AsInt(fastargs[1]);
if (digest_size == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[2]) {
if (PyObject_GetBuffer(fastargs[2], &key, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&key, 'C')) {
_PyArg_BadArgument("blake2s", 3, "contiguous buffer", fastargs[2]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[3]) {
if (PyObject_GetBuffer(fastargs[3], &salt, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&salt, 'C')) {
_PyArg_BadArgument("blake2s", 4, "contiguous buffer", fastargs[3]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[4]) {
if (PyObject_GetBuffer(fastargs[4], &person, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&person, 'C')) {
_PyArg_BadArgument("blake2s", 5, "contiguous buffer", fastargs[4]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[5]) {
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[6]) {
if (PyFloat_Check(fastargs[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[7]) {
if (!_PyLong_UnsignedLong_Converter(fastargs[7], &leaf_size)) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[8]) {
if (!_PyLong_UnsignedLongLong_Converter(fastargs[8], &node_offset)) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[9]) {
if (PyFloat_Check(fastargs[9])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
node_depth = _PyLong_AsInt(fastargs[9]);
if (node_depth == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[10]) {
if (PyFloat_Check(fastargs[10])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
inner_size = _PyLong_AsInt(fastargs[10]);
if (inner_size == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
last_node = PyObject_IsTrue(fastargs[11]);
if (last_node < 0) {
goto exit;
}
skip_optional_kwonly:
return_value = py_blake2s_new_impl(type, data, digest_size, &key, &salt, &person, fanout, depth, leaf_size, node_offset, node_depth, inner_size, last_node);
exit:
@ -121,4 +261,4 @@ _blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
{
return _blake2_blake2s_hexdigest_impl(self);
}
/*[clinic end generated code: output=a31a1d56f0e0781f input=a9049054013a1b77]*/
/*[clinic end generated code: output=ae8e9b7301d092b4 input=a9049054013a1b77]*/

View file

@ -139,7 +139,9 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener", NULL};
static _PyArg_Parser _parser = {"O|sizzziO:open", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "open", 0};
PyObject *argsbuf[8];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *file;
const char *mode = "r";
int buffering = -1;
@ -149,13 +151,134 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
int closefd = 1;
PyObject *opener = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 8, 0, argsbuf);
if (!args) {
goto exit;
}
file = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (!PyUnicode_Check(args[1])) {
_PyArg_BadArgument("open", 2, "str", args[1]);
goto exit;
}
Py_ssize_t mode_length;
mode = PyUnicode_AsUTF8AndSize(args[1], &mode_length);
if (mode == NULL) {
goto exit;
}
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
buffering = _PyLong_AsInt(args[2]);
if (buffering == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[3]) {
if (args[3] == Py_None) {
encoding = NULL;
}
else if (PyUnicode_Check(args[3])) {
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[3], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("open", 4, "str or None", args[3]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[4]) {
if (args[4] == Py_None) {
errors = NULL;
}
else if (PyUnicode_Check(args[4])) {
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[4], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("open", 5, "str or None", args[4]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[5]) {
if (args[5] == Py_None) {
newline = NULL;
}
else if (PyUnicode_Check(args[5])) {
Py_ssize_t newline_length;
newline = PyUnicode_AsUTF8AndSize(args[5], &newline_length);
if (newline == NULL) {
goto exit;
}
if (strlen(newline) != (size_t)newline_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("open", 6, "str or None", args[5]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[6]) {
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(args[6]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
opener = args[7];
skip_optional_pos:
return_value = _io_open_impl(module, file, mode, buffering, encoding, errors, newline, closefd, opener);
exit:
return return_value;
}
/*[clinic end generated code: output=a2c1af38d943ccec input=a9049054013a1b77]*/
/*[clinic end generated code: output=19fc9b69a5166f63 input=a9049054013a1b77]*/

View file

@ -418,14 +418,40 @@ _io_BufferedReader___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"raw", "buffer_size", NULL};
static _PyArg_Parser _parser = {"O|n:BufferedReader", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "BufferedReader", 0};
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) - 1;
PyObject *raw;
Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&raw, &buffer_size)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
raw = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
buffer_size = ival;
}
skip_optional_pos:
return_value = _io_BufferedReader___init___impl((buffered *)self, raw, buffer_size);
exit:
@ -451,14 +477,40 @@ _io_BufferedWriter___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"raw", "buffer_size", NULL};
static _PyArg_Parser _parser = {"O|n:BufferedWriter", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "BufferedWriter", 0};
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) - 1;
PyObject *raw;
Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&raw, &buffer_size)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
raw = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
buffer_size = ival;
}
skip_optional_pos:
return_value = _io_BufferedWriter___init___impl((buffered *)self, raw, buffer_size);
exit:
@ -581,17 +633,43 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"raw", "buffer_size", NULL};
static _PyArg_Parser _parser = {"O|n:BufferedRandom", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "BufferedRandom", 0};
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) - 1;
PyObject *raw;
Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&raw, &buffer_size)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
raw = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
buffer_size = ival;
}
skip_optional_pos:
return_value = _io_BufferedRandom___init___impl((buffered *)self, raw, buffer_size);
exit:
return return_value;
}
/*[clinic end generated code: output=b7f51040defff318 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b22b4aedd53c340a input=a9049054013a1b77]*/

View file

@ -494,16 +494,25 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"initial_bytes", NULL};
static _PyArg_Parser _parser = {"|O:BytesIO", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "BytesIO", 0};
PyObject *argsbuf[1];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *initvalue = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&initvalue)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
initvalue = fastargs[0];
skip_optional_pos:
return_value = _io_BytesIO___init___impl((bytesio *)self, initvalue);
exit:
return return_value;
}
/*[clinic end generated code: output=a6b47dd7921abfcd input=a9049054013a1b77]*/
/*[clinic end generated code: output=22e8fb54874b6ee5 input=a9049054013a1b77]*/

View file

@ -50,16 +50,58 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "mode", "closefd", "opener", NULL};
static _PyArg_Parser _parser = {"O|siO:FileIO", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "FileIO", 0};
PyObject *argsbuf[4];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *nameobj;
const char *mode = "r";
int closefd = 1;
PyObject *opener = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&nameobj, &mode, &closefd, &opener)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 4, 0, argsbuf);
if (!fastargs) {
goto exit;
}
nameobj = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[1]) {
if (!PyUnicode_Check(fastargs[1])) {
_PyArg_BadArgument("FileIO", 2, "str", fastargs[1]);
goto exit;
}
Py_ssize_t mode_length;
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
if (mode == NULL) {
goto exit;
}
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[2]) {
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
opener = fastargs[3];
skip_optional_pos:
return_value = _io_FileIO___init___impl((fileio *)self, nameobj, mode, closefd, opener);
exit:
@ -405,4 +447,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
/*[clinic end generated code: output=b6f327457938d4dd input=a9049054013a1b77]*/
/*[clinic end generated code: output=7ee4f3ae584fc6d2 input=a9049054013a1b77]*/

View file

@ -266,14 +266,29 @@ _io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"initial_value", "newline", NULL};
static _PyArg_Parser _parser = {"|OO:StringIO", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "StringIO", 0};
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;
PyObject *value = NULL;
PyObject *newline_obj = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&value, &newline_obj)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[0]) {
value = fastargs[0];
if (!--noptargs) {
goto skip_optional_pos;
}
}
newline_obj = fastargs[1];
skip_optional_pos:
return_value = _io_StringIO___init___impl((stringio *)self, value, newline_obj);
exit:
@ -333,4 +348,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{
return _io_StringIO_seekable_impl(self);
}
/*[clinic end generated code: output=db5e51dcc4dae8d5 input=a9049054013a1b77]*/
/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/

View file

@ -25,15 +25,34 @@ _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject
{
int return_value = -1;
static const char * const _keywords[] = {"decoder", "translate", "errors", NULL};
static _PyArg_Parser _parser = {"Oi|O:IncrementalNewlineDecoder", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "IncrementalNewlineDecoder", 0};
PyObject *argsbuf[3];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 2;
PyObject *decoder;
int translate;
PyObject *errors = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&decoder, &translate, &errors)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 3, 0, argsbuf);
if (!fastargs) {
goto exit;
}
decoder = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
translate = _PyLong_AsInt(fastargs[1]);
if (translate == -1 && PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
errors = fastargs[2];
skip_optional_pos:
return_value = _io_IncrementalNewlineDecoder___init___impl((nldecoder_object *)self, decoder, translate, errors);
exit:
@ -57,14 +76,30 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject *const *ar
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"input", "final", NULL};
static _PyArg_Parser _parser = {"O|i:decode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *input;
int final = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&input, &final)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
input = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = _io_IncrementalNewlineDecoder_decode_impl(self, input, final);
exit:
@ -158,7 +193,11 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"buffer", "encoding", "errors", "newline", "line_buffering", "write_through", NULL};
static _PyArg_Parser _parser = {"O|zOzii:TextIOWrapper", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "TextIOWrapper", 0};
PyObject *argsbuf[6];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *buffer;
const char *encoding = NULL;
PyObject *errors = Py_None;
@ -166,10 +205,90 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
int line_buffering = 0;
int write_through = 0;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&buffer, &encoding, &errors, &newline, &line_buffering, &write_through)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 6, 0, argsbuf);
if (!fastargs) {
goto exit;
}
buffer = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[1]) {
if (fastargs[1] == Py_None) {
encoding = NULL;
}
else if (PyUnicode_Check(fastargs[1])) {
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("TextIOWrapper", 2, "str or None", fastargs[1]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[2]) {
errors = fastargs[2];
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[3]) {
if (fastargs[3] == Py_None) {
newline = NULL;
}
else if (PyUnicode_Check(fastargs[3])) {
Py_ssize_t newline_length;
newline = PyUnicode_AsUTF8AndSize(fastargs[3], &newline_length);
if (newline == NULL) {
goto exit;
}
if (strlen(newline) != (size_t)newline_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("TextIOWrapper", 4, "str or None", fastargs[3]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[4]) {
if (PyFloat_Check(fastargs[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
line_buffering = _PyLong_AsInt(fastargs[4]);
if (line_buffering == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
write_through = _PyLong_AsInt(fastargs[5]);
if (write_through == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = _io_TextIOWrapper___init___impl((textio *)self, buffer, encoding, errors, newline, line_buffering, write_through);
exit:
@ -199,17 +318,48 @@ _io_TextIOWrapper_reconfigure(textio *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"encoding", "errors", "newline", "line_buffering", "write_through", NULL};
static _PyArg_Parser _parser = {"|$OOOOO:reconfigure", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "reconfigure", 0};
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *encoding = Py_None;
PyObject *errors = Py_None;
PyObject *newline_obj = NULL;
PyObject *line_buffering_obj = Py_None;
PyObject *write_through_obj = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&encoding, &errors, &newline_obj, &line_buffering_obj, &write_through_obj)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[0]) {
encoding = args[0];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[1]) {
errors = args[1];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[2]) {
newline_obj = args[2];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[3]) {
line_buffering_obj = args[3];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
write_through_obj = args[4];
skip_optional_kwonly:
return_value = _io_TextIOWrapper_reconfigure_impl(self, encoding, errors, newline_obj, line_buffering_obj, write_through_obj);
exit:
@ -551,4 +701,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
/*[clinic end generated code: output=c3d1b2a5d2d2d429 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b651e056e3000f88 input=a9049054013a1b77]*/

View file

@ -49,16 +49,58 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "mode", "closefd", "opener", NULL};
static _PyArg_Parser _parser = {"O|siO:_WindowsConsoleIO", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_WindowsConsoleIO", 0};
PyObject *argsbuf[4];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *nameobj;
const char *mode = "r";
int closefd = 1;
PyObject *opener = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&nameobj, &mode, &closefd, &opener)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 4, 0, argsbuf);
if (!fastargs) {
goto exit;
}
nameobj = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[1]) {
if (!PyUnicode_Check(fastargs[1])) {
_PyArg_BadArgument("_WindowsConsoleIO", 2, "str", fastargs[1]);
goto exit;
}
Py_ssize_t mode_length;
mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
if (mode == NULL) {
goto exit;
}
if (strlen(mode) != (size_t)mode_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[2]) {
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
opener = fastargs[3];
skip_optional_pos:
return_value = _io__WindowsConsoleIO___init___impl((winconsoleio *)self, nameobj, mode, closefd, opener);
exit:
@ -344,4 +386,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
/*[clinic end generated code: output=ab0f0ee8062eecb3 input=a9049054013a1b77]*/
/*[clinic end generated code: output=57bf2c09a42bd330 input=a9049054013a1b77]*/

View file

@ -22,16 +22,48 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "flags", "mode", NULL};
static _PyArg_Parser _parser = {"Ui|i:shm_open", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "shm_open", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *path;
int flags;
int mode = 511;
int _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path, &flags, &mode)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("shm_open", 1, "str", args[0]);
goto exit;
}
if (PyUnicode_READY(args[0]) == -1) {
goto exit;
}
path = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
_return_value = _posixshmem_shm_open_impl(module, path, flags, mode);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -67,13 +99,22 @@ _posixshmem_shm_unlink(PyObject *module, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", NULL};
static _PyArg_Parser _parser = {"U:shm_unlink", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "shm_unlink", 0};
PyObject *argsbuf[1];
PyObject *path;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("shm_unlink", 1, "str", args[0]);
goto exit;
}
if (PyUnicode_READY(args[0]) == -1) {
goto exit;
}
path = args[0];
return_value = _posixshmem_shm_unlink_impl(module, path);
exit:
@ -89,4 +130,4 @@ exit:
#ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
#define _POSIXSHMEM_SHM_UNLINK_METHODDEF
#endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
/*[clinic end generated code: output=ff9cf0bc9b8baddf input=a9049054013a1b77]*/
/*[clinic end generated code: output=be42e23c18677c0f input=a9049054013a1b77]*/

View file

@ -26,14 +26,39 @@ _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *cons
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"input", "errors", NULL};
static _PyArg_Parser _parser = {"O|z:encode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *input;
const char *errors = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&input, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
input = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1] == Py_None) {
errors = NULL;
}
else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("encode", 2, "str or None", args[1]);
goto exit;
}
skip_optional_pos:
return_value = _multibytecodec_MultibyteCodec_encode_impl(self, input, errors);
exit:
@ -64,14 +89,45 @@ _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *cons
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"input", "errors", NULL};
static _PyArg_Parser _parser = {"y*|z:decode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer input = {NULL, NULL};
const char *errors = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&input, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &input, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&input, 'C')) {
_PyArg_BadArgument("decode", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1] == Py_None) {
errors = NULL;
}
else if (PyUnicode_Check(args[1])) {
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("decode", 2, "str or None", args[1]);
goto exit;
}
skip_optional_pos:
return_value = _multibytecodec_MultibyteCodec_decode_impl(self, &input, errors);
exit:
@ -101,14 +157,30 @@ _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"input", "final", NULL};
static _PyArg_Parser _parser = {"O|i:encode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *input;
int final = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&input, &final)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
input = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = _multibytecodec_MultibyteIncrementalEncoder_encode_impl(self, input, final);
exit:
@ -196,14 +268,36 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"input", "final", NULL};
static _PyArg_Parser _parser = {"y*|i:decode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer input = {NULL, NULL};
int final = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&input, &final)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &input, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&input, 'C')) {
_PyArg_BadArgument("decode", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = _multibytecodec_MultibyteIncrementalDecoder_decode_impl(self, &input, final);
exit:
@ -431,4 +525,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
/*[clinic end generated code: output=bcd6311010557faf input=a9049054013a1b77]*/
/*[clinic end generated code: output=eb95a408c4ddbfff input=a9049054013a1b77]*/

View file

@ -27,13 +27,22 @@ _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"loop", NULL};
static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "Future", 0};
PyObject *argsbuf[1];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *loop = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&loop)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
loop = fastargs[0];
skip_optional_kwonly:
return_value = _asyncio_Future___init___impl((FutureObj *)self, loop);
exit:
@ -131,14 +140,22 @@ _asyncio_Future_add_done_callback(FutureObj *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "context", NULL};
static _PyArg_Parser _parser = {"O|$O:add_done_callback", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "add_done_callback", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *fn;
PyObject *context = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&fn, &context)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
fn = args[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
context = args[1];
skip_optional_kwonly:
return_value = _asyncio_Future_add_done_callback_impl(self, fn, context);
exit:
@ -267,15 +284,31 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"coro", "loop", "name", NULL};
static _PyArg_Parser _parser = {"O|$OO:Task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "Task", 0};
PyObject *argsbuf[3];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *coro;
PyObject *loop = Py_None;
PyObject *name = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&coro, &loop, &name)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
coro = fastargs[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
if (fastargs[1]) {
loop = fastargs[1];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
name = fastargs[2];
skip_optional_kwonly:
return_value = _asyncio_Task___init___impl((TaskObj *)self, coro, loop, name);
exit:
@ -303,13 +336,20 @@ _asyncio_Task_current_task(PyTypeObject *type, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
static _PyArg_Parser _parser = {"|O:current_task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "current_task", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *loop = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
loop = args[0];
skip_optional_pos:
return_value = _asyncio_Task_current_task_impl(type, loop);
exit:
@ -335,13 +375,20 @@ _asyncio_Task_all_tasks(PyTypeObject *type, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", NULL};
static _PyArg_Parser _parser = {"|O:all_tasks", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "all_tasks", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *loop = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
loop = args[0];
skip_optional_pos:
return_value = _asyncio_Task_all_tasks_impl(type, loop);
exit:
@ -435,13 +482,20 @@ _asyncio_Task_get_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"limit", NULL};
static _PyArg_Parser _parser = {"|$O:get_stack", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get_stack", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *limit = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&limit)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
limit = args[0];
skip_optional_kwonly:
return_value = _asyncio_Task_get_stack_impl(self, limit);
exit:
@ -472,14 +526,27 @@ _asyncio_Task_print_stack(TaskObj *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"limit", "file", NULL};
static _PyArg_Parser _parser = {"|$OO:print_stack", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "print_stack", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *limit = Py_None;
PyObject *file = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&limit, &file)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[0]) {
limit = args[0];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
file = args[1];
skip_optional_kwonly:
return_value = _asyncio_Task_print_stack_impl(self, limit, file);
exit:
@ -624,13 +691,15 @@ _asyncio__register_task(PyObject *module, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"task", NULL};
static _PyArg_Parser _parser = {"O:_register_task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_register_task", 0};
PyObject *argsbuf[1];
PyObject *task;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&task)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
task = args[0];
return_value = _asyncio__register_task_impl(module, task);
exit:
@ -656,13 +725,15 @@ _asyncio__unregister_task(PyObject *module, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"task", NULL};
static _PyArg_Parser _parser = {"O:_unregister_task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_unregister_task", 0};
PyObject *argsbuf[1];
PyObject *task;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&task)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
task = args[0];
return_value = _asyncio__unregister_task_impl(module, task);
exit:
@ -690,14 +761,17 @@ _asyncio__enter_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", "task", NULL};
static _PyArg_Parser _parser = {"OO:_enter_task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_enter_task", 0};
PyObject *argsbuf[2];
PyObject *loop;
PyObject *task;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop, &task)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
loop = args[0];
task = args[1];
return_value = _asyncio__enter_task_impl(module, loop, task);
exit:
@ -725,17 +799,20 @@ _asyncio__leave_task(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"loop", "task", NULL};
static _PyArg_Parser _parser = {"OO:_leave_task", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_leave_task", 0};
PyObject *argsbuf[2];
PyObject *loop;
PyObject *task;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&loop, &task)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
loop = args[0];
task = args[1];
return_value = _asyncio__leave_task_impl(module, loop, task);
exit:
return return_value;
}
/*[clinic end generated code: output=fd474bdc8f03d5ae input=a9049054013a1b77]*/
/*[clinic end generated code: output=e3b02d96da56e80c input=a9049054013a1b77]*/

View file

@ -142,14 +142,44 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "max_length", NULL};
static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &max_length)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
max_length = ival;
}
skip_optional_pos:
return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length);
exit:
@ -190,4 +220,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=892c6133e97ff840 input=a9049054013a1b77]*/
/*[clinic end generated code: output=8e123f4eec497655 input=a9049054013a1b77]*/

View file

@ -76,15 +76,53 @@ _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&obj, &encoding, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
obj = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (!PyUnicode_Check(args[1])) {
_PyArg_BadArgument("encode", 2, "str", args[1]);
goto exit;
}
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (!PyUnicode_Check(args[2])) {
_PyArg_BadArgument("encode", 3, "str", args[2]);
goto exit;
}
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos:
return_value = _codecs_encode_impl(module, obj, encoding, errors);
exit:
@ -115,15 +153,53 @@ _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
const char *encoding = NULL;
const char *errors = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&obj, &encoding, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
obj = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (!PyUnicode_Check(args[1])) {
_PyArg_BadArgument("decode", 2, "str", args[1]);
goto exit;
}
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (!PyUnicode_Check(args[2])) {
_PyArg_BadArgument("decode", 3, "str", args[2]);
goto exit;
}
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos:
return_value = _codecs_decode_impl(module, obj, encoding, errors);
exit:
@ -2948,4 +3024,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
/*[clinic end generated code: output=85ea29db163ee74c input=a9049054013a1b77]*/
/*[clinic end generated code: output=02bd0f0cf9a28150 input=a9049054013a1b77]*/

View file

@ -2988,14 +2988,52 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"term", "fd", NULL};
static _PyArg_Parser _parser = {"|zi:setupterm", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "setupterm", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *term = NULL;
int fd = -1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&term, &fd)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
if (args[0] == Py_None) {
term = NULL;
}
else if (PyUnicode_Check(args[0])) {
Py_ssize_t term_length;
term = PyUnicode_AsUTF8AndSize(args[0], &term_length);
if (term == NULL) {
goto exit;
}
if (strlen(term) != (size_t)term_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("setupterm", 1, "str or None", args[0]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[1]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = _curses_setupterm_impl(module, term, fd);
exit:
@ -4531,4 +4569,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
/*[clinic end generated code: output=5305982cb312a911 input=a9049054013a1b77]*/
/*[clinic end generated code: output=1350eeb0c1e06af6 input=a9049054013a1b77]*/

View file

@ -36,16 +36,23 @@ datetime_datetime_now(PyTypeObject *type, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tz", NULL};
static _PyArg_Parser _parser = {"|O:now", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "now", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tz = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&tz)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
tz = args[0];
skip_optional_pos:
return_value = datetime_datetime_now_impl(type, tz);
exit:
return return_value;
}
/*[clinic end generated code: output=b3d746843403a8ce input=a9049054013a1b77]*/
/*[clinic end generated code: output=aae916ab728ca85b input=a9049054013a1b77]*/

View file

@ -169,14 +169,22 @@ _elementtree_Element_find(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
static _PyArg_Parser _parser = {"O|O:find", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "find", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path, &namespaces)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
path = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
namespaces = args[1];
skip_optional_pos:
return_value = _elementtree_Element_find_impl(self, path, namespaces);
exit:
@ -201,15 +209,29 @@ _elementtree_Element_findtext(ElementObject *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "default", "namespaces", NULL};
static _PyArg_Parser _parser = {"O|OO:findtext", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "findtext", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *default_value = Py_None;
PyObject *namespaces = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path, &default_value, &namespaces)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
path = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
default_value = args[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
namespaces = args[2];
skip_optional_pos:
return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces);
exit:
@ -233,14 +255,22 @@ _elementtree_Element_findall(ElementObject *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
static _PyArg_Parser _parser = {"O|O:findall", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path, &namespaces)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
path = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
namespaces = args[1];
skip_optional_pos:
return_value = _elementtree_Element_findall_impl(self, path, namespaces);
exit:
@ -264,14 +294,22 @@ _elementtree_Element_iterfind(ElementObject *self, PyObject *const *args, Py_ssi
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"path", "namespaces", NULL};
static _PyArg_Parser _parser = {"O|O:iterfind", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "iterfind", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *path;
PyObject *namespaces = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&path, &namespaces)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
path = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
namespaces = args[1];
skip_optional_pos:
return_value = _elementtree_Element_iterfind_impl(self, path, namespaces);
exit:
@ -295,14 +333,22 @@ _elementtree_Element_get(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "default", NULL};
static _PyArg_Parser _parser = {"O|O:get", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *key;
PyObject *default_value = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&key, &default_value)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
key = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
default_value = args[1];
skip_optional_pos:
return_value = _elementtree_Element_get_impl(self, key, default_value);
exit:
@ -342,13 +388,20 @@ _elementtree_Element_iter(ElementObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tag", NULL};
static _PyArg_Parser _parser = {"|O:iter", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "iter", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tag = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&tag)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
tag = args[0];
skip_optional_pos:
return_value = _elementtree_Element_iter_impl(self, tag);
exit:
@ -371,13 +424,20 @@ _elementtree_Element_getiterator(ElementObject *self, PyObject *const *args, Py_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"tag", NULL};
static _PyArg_Parser _parser = {"|O:getiterator", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "getiterator", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *tag = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&tag)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
tag = args[0];
skip_optional_pos:
return_value = _elementtree_Element_getiterator_impl(self, tag);
exit:
@ -582,13 +642,22 @@ _elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwar
{
int return_value = -1;
static const char * const _keywords[] = {"element_factory", NULL};
static _PyArg_Parser _parser = {"|O:TreeBuilder", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "TreeBuilder", 0};
PyObject *argsbuf[1];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *element_factory = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&element_factory)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
element_factory = fastargs[0];
skip_optional_pos:
return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory);
exit:
@ -671,14 +740,46 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs
{
int return_value = -1;
static const char * const _keywords[] = {"target", "encoding", NULL};
static _PyArg_Parser _parser = {"|$Oz:XMLParser", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "XMLParser", 0};
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;
PyObject *target = NULL;
const char *encoding = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&target, &encoding)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (fastargs[0]) {
target = fastargs[0];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[1] == Py_None) {
encoding = NULL;
}
else if (PyUnicode_Check(fastargs[1])) {
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("XMLParser", 2, "str or None", fastargs[1]);
goto exit;
}
skip_optional_kwonly:
return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, target, encoding);
exit:
@ -752,4 +853,4 @@ skip_optional:
exit:
return return_value;
}
/*[clinic end generated code: output=0c15c41e03a7829f input=a9049054013a1b77]*/
/*[clinic end generated code: output=440b5d90a4b86590 input=a9049054013a1b77]*/

View file

@ -87,14 +87,22 @@ EVP_new(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"name", "string", NULL};
static _PyArg_Parser _parser = {"O|O:new", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "new", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *name_obj;
PyObject *data_obj = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&name_obj, &data_obj)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
name_obj = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
data_obj = args[1];
skip_optional_pos:
return_value = EVP_new_impl(module, name_obj, data_obj);
exit:
@ -123,17 +131,60 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"hash_name", "password", "salt", "iterations", "dklen", NULL};
static _PyArg_Parser _parser = {"sy*y*l|O:pbkdf2_hmac", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "pbkdf2_hmac", 0};
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 4;
const char *hash_name;
Py_buffer password = {NULL, NULL};
Py_buffer salt = {NULL, NULL};
long iterations;
PyObject *dklen_obj = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&hash_name, &password, &salt, &iterations, &dklen_obj)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 5, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("pbkdf2_hmac", 1, "str", args[0]);
goto exit;
}
Py_ssize_t hash_name_length;
hash_name = PyUnicode_AsUTF8AndSize(args[0], &hash_name_length);
if (hash_name == NULL) {
goto exit;
}
if (strlen(hash_name) != (size_t)hash_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (PyObject_GetBuffer(args[1], &password, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&password, 'C')) {
_PyArg_BadArgument("pbkdf2_hmac", 2, "contiguous buffer", args[1]);
goto exit;
}
if (PyObject_GetBuffer(args[2], &salt, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&salt, 'C')) {
_PyArg_BadArgument("pbkdf2_hmac", 3, "contiguous buffer", args[2]);
goto exit;
}
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
iterations = PyLong_AsLong(args[3]);
if (iterations == -1 && PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
dklen_obj = args[4];
skip_optional_pos:
return_value = pbkdf2_hmac_impl(module, hash_name, &password, &salt, iterations, dklen_obj);
exit:
@ -173,7 +224,9 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"password", "salt", "n", "r", "p", "maxmem", "dklen", NULL};
static _PyArg_Parser _parser = {"y*|$y*O!O!O!ll:scrypt", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "scrypt", 0};
PyObject *argsbuf[7];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer password = {NULL, NULL};
Py_buffer salt = {NULL, NULL};
PyObject *n_obj = Py_None;
@ -182,10 +235,86 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
long maxmem = 0;
long dklen = 64;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&password, &salt, &PyLong_Type, &n_obj, &PyLong_Type, &r_obj, &PyLong_Type, &p_obj, &maxmem, &dklen)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &password, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&password, 'C')) {
_PyArg_BadArgument("scrypt", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[1]) {
if (PyObject_GetBuffer(args[1], &salt, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&salt, 'C')) {
_PyArg_BadArgument("scrypt", 2, "contiguous buffer", args[1]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[2]) {
if (!PyLong_Check(args[2])) {
_PyArg_BadArgument("scrypt", 3, "int", args[2]);
goto exit;
}
n_obj = args[2];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[3]) {
if (!PyLong_Check(args[3])) {
_PyArg_BadArgument("scrypt", 4, "int", args[3]);
goto exit;
}
r_obj = args[3];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[4]) {
if (!PyLong_Check(args[4])) {
_PyArg_BadArgument("scrypt", 5, "int", args[4]);
goto exit;
}
p_obj = args[4];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[5]) {
if (PyFloat_Check(args[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
maxmem = PyLong_AsLong(args[5]);
if (maxmem == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
dklen = PyLong_AsLong(args[6]);
if (dklen == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_kwonly:
return_value = _hashlib_scrypt_impl(module, &password, &salt, n_obj, r_obj, p_obj, maxmem, dklen);
exit:
@ -221,13 +350,41 @@ _hashlib_hmac_digest(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "msg", "digest", NULL};
static _PyArg_Parser _parser = {"y*y*s:hmac_digest", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "hmac_digest", 0};
PyObject *argsbuf[3];
Py_buffer key = {NULL, NULL};
Py_buffer msg = {NULL, NULL};
const char *digest;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&key, &msg, &digest)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &key, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&key, 'C')) {
_PyArg_BadArgument("hmac_digest", 1, "contiguous buffer", args[0]);
goto exit;
}
if (PyObject_GetBuffer(args[1], &msg, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&msg, 'C')) {
_PyArg_BadArgument("hmac_digest", 2, "contiguous buffer", args[1]);
goto exit;
}
if (!PyUnicode_Check(args[2])) {
_PyArg_BadArgument("hmac_digest", 3, "str", args[2]);
goto exit;
}
Py_ssize_t digest_length;
digest = PyUnicode_AsUTF8AndSize(args[2], &digest_length);
if (digest == NULL) {
goto exit;
}
if (strlen(digest) != (size_t)digest_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _hashlib_hmac_digest_impl(module, &key, &msg, digest);
@ -252,4 +409,4 @@ exit:
#ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
/*[clinic end generated code: output=fe5931d2b301ca12 input=a9049054013a1b77]*/
/*[clinic end generated code: output=5955ec791260045a input=a9049054013a1b77]*/

View file

@ -96,14 +96,44 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *const *args, Py_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "max_length", NULL};
static _PyArg_Parser _parser = {"y*|n:decompress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = -1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &max_length)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
max_length = ival;
}
skip_optional_pos:
return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length);
exit:
@ -147,15 +177,44 @@ _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs
{
int return_value = -1;
static const char * const _keywords[] = {"format", "memlimit", "filters", NULL};
static _PyArg_Parser _parser = {"|iOO:LZMADecompressor", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "LZMADecompressor", 0};
PyObject *argsbuf[3];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
int format = FORMAT_AUTO;
PyObject *memlimit = Py_None;
PyObject *filters = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&format, &memlimit, &filters)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 3, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[0]) {
if (PyFloat_Check(fastargs[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
format = _PyLong_AsInt(fastargs[0]);
if (format == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (fastargs[1]) {
memlimit = fastargs[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
filters = fastargs[2];
skip_optional_pos:
return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters);
exit:
@ -275,4 +334,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=47e4732df79509ad input=a9049054013a1b77]*/
/*[clinic end generated code: output=1a290aa478603107 input=a9049054013a1b77]*/

View file

@ -20,16 +20,38 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "", "jump", NULL};
static _PyArg_Parser _parser = {"i|O$O:stack_effect", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "stack_effect", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
int opcode;
PyObject *oparg = Py_None;
PyObject *jump = Py_None;
int _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&opcode, &oparg, &jump)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
opcode = _PyLong_AsInt(args[0]);
if (opcode == -1 && PyErr_Occurred()) {
goto exit;
}
if (nargs < 2) {
goto skip_optional_posonly;
}
noptargs--;
oparg = args[1];
skip_optional_posonly:
if (!noptargs) {
goto skip_optional_kwonly;
}
jump = args[2];
skip_optional_kwonly:
_return_value = _opcode_stack_effect_impl(module, opcode, oparg, jump);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -39,4 +61,4 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
exit:
return return_value;
}
/*[clinic end generated code: output=871941eea3d855c6 input=a9049054013a1b77]*/
/*[clinic end generated code: output=7bc08f2835b2cf89 input=a9049054013a1b77]*/

View file

@ -94,15 +94,34 @@ _pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "protocol", "fix_imports", NULL};
static _PyArg_Parser _parser = {"O|Op:Pickler", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "Pickler", 0};
PyObject *argsbuf[3];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&file, &protocol, &fix_imports)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 3, 0, argsbuf);
if (!fastargs) {
goto exit;
}
file = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[1]) {
protocol = fastargs[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
fix_imports = PyObject_IsTrue(fastargs[2]);
if (fix_imports < 0) {
goto exit;
}
skip_optional_pos:
return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports);
exit:
@ -287,16 +306,65 @@ _pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
static _PyArg_Parser _parser = {"O|$pss:Unpickler", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "Unpickler", 0};
PyObject *argsbuf[4];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&file, &fix_imports, &encoding, &errors)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
file = fastargs[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
if (fastargs[1]) {
fix_imports = PyObject_IsTrue(fastargs[1]);
if (fix_imports < 0) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (fastargs[2]) {
if (!PyUnicode_Check(fastargs[2])) {
_PyArg_BadArgument("Unpickler", 3, "str", fastargs[2]);
goto exit;
}
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(fastargs[2], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (!PyUnicode_Check(fastargs[3])) {
_PyArg_BadArgument("Unpickler", 4, "str", fastargs[3]);
goto exit;
}
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(fastargs[3], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly:
return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors);
exit:
@ -396,16 +464,38 @@ _pickle_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "file", "protocol", "fix_imports", NULL};
static _PyArg_Parser _parser = {"OO|O$p:dump", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "dump", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *obj;
PyObject *file;
PyObject *protocol = NULL;
int fix_imports = 1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&obj, &file, &protocol, &fix_imports)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
obj = args[0];
file = args[1];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[2]) {
protocol = args[2];
if (!--noptargs) {
goto skip_optional_pos;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
fix_imports = PyObject_IsTrue(args[3]);
if (fix_imports < 0) {
goto exit;
}
skip_optional_kwonly:
return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports);
exit:
@ -443,15 +533,36 @@ _pickle_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"obj", "protocol", "fix_imports", NULL};
static _PyArg_Parser _parser = {"O|O$p:dumps", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "dumps", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
PyObject *protocol = NULL;
int fix_imports = 1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&obj, &protocol, &fix_imports)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
obj = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
protocol = args[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
fix_imports = PyObject_IsTrue(args[2]);
if (fix_imports < 0) {
goto exit;
}
skip_optional_kwonly:
return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports);
exit:
@ -499,16 +610,63 @@ _pickle_load(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"file", "fix_imports", "encoding", "errors", NULL};
static _PyArg_Parser _parser = {"O|$pss:load", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "load", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *file;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&file, &fix_imports, &encoding, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
file = args[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[1]) {
fix_imports = PyObject_IsTrue(args[1]);
if (fix_imports < 0) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[2]) {
if (!PyUnicode_Check(args[2])) {
_PyArg_BadArgument("load", 3, "str", args[2]);
goto exit;
}
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (!PyUnicode_Check(args[3])) {
_PyArg_BadArgument("load", 4, "str", args[3]);
goto exit;
}
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly:
return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors);
exit:
@ -547,19 +705,66 @@ _pickle_loads(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "fix_imports", "encoding", "errors", NULL};
static _PyArg_Parser _parser = {"O|$pss:loads", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "loads", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *data;
int fix_imports = 1;
const char *encoding = "ASCII";
const char *errors = "strict";
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &fix_imports, &encoding, &errors)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
data = args[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[1]) {
fix_imports = PyObject_IsTrue(args[1]);
if (fix_imports < 0) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (args[2]) {
if (!PyUnicode_Check(args[2])) {
_PyArg_BadArgument("loads", 3, "str", args[2]);
goto exit;
}
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[2], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
if (!PyUnicode_Check(args[3])) {
_PyArg_BadArgument("loads", 4, "str", args[3]);
goto exit;
}
Py_ssize_t errors_length;
errors = PyUnicode_AsUTF8AndSize(args[3], &errors_length);
if (errors == NULL) {
goto exit;
}
if (strlen(errors) != (size_t)errors_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_kwonly:
return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors);
exit:
return return_value;
}
/*[clinic end generated code: output=225f06abcf27ed2b input=a9049054013a1b77]*/
/*[clinic end generated code: output=8f972562c8f71e2b input=a9049054013a1b77]*/

View file

@ -51,15 +51,32 @@ _queue_SimpleQueue_put(simplequeueobject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"item", "block", "timeout", NULL};
static _PyArg_Parser _parser = {"O|pO:put", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "put", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *item;
int block = 1;
PyObject *timeout = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&item, &block, &timeout)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
item = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
block = PyObject_IsTrue(args[1]);
if (block < 0) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
timeout = args[2];
skip_optional_pos:
return_value = _queue_SimpleQueue_put_impl(self, item, block, timeout);
exit:
@ -86,13 +103,15 @@ _queue_SimpleQueue_put_nowait(simplequeueobject *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"item", NULL};
static _PyArg_Parser _parser = {"O:put_nowait", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "put_nowait", 0};
PyObject *argsbuf[1];
PyObject *item;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&item)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
item = args[0];
return_value = _queue_SimpleQueue_put_nowait_impl(self, item);
exit:
@ -125,14 +144,30 @@ _queue_SimpleQueue_get(simplequeueobject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"block", "timeout", NULL};
static _PyArg_Parser _parser = {"|pO:get", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int block = 1;
PyObject *timeout = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&block, &timeout)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
block = PyObject_IsTrue(args[0]);
if (block < 0) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
timeout = args[1];
skip_optional_pos:
return_value = _queue_SimpleQueue_get_impl(self, block, timeout);
exit:
@ -215,4 +250,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
/*[clinic end generated code: output=c12ce9050f153304 input=a9049054013a1b77]*/
/*[clinic end generated code: output=b4717e2974cbc909 input=a9049054013a1b77]*/

489
Modules/clinic/_sre.c.h generated
View file

@ -195,15 +195,61 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:match", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "match", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos);
exit:
@ -228,15 +274,61 @@ _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:fullmatch", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "fullmatch", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos);
exit:
@ -263,15 +355,61 @@ _sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t n
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:search", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "search", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos);
exit:
@ -296,15 +434,61 @@ _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:findall", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos);
exit:
@ -331,15 +515,61 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:finditer", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "finditer", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos);
exit:
@ -363,15 +593,61 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "pos", "endpos", NULL};
static _PyArg_Parser _parser = {"O|nn:scanner", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "scanner", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t pos = 0;
Py_ssize_t endpos = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &pos, &endpos)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
pos = ival;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
endpos = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos);
exit:
@ -396,14 +672,38 @@ _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", "maxsplit", NULL};
static _PyArg_Parser _parser = {"O|n:split", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "split", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *string;
Py_ssize_t maxsplit = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string, &maxsplit)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
string = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
maxsplit = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit);
exit:
@ -428,15 +728,40 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"repl", "string", "count", NULL};
static _PyArg_Parser _parser = {"OO|n:sub", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sub", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&repl, &string, &count)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
repl = args[0];
string = args[1];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
count = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count);
exit:
@ -461,15 +786,40 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nar
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"repl", "string", "count", NULL};
static _PyArg_Parser _parser = {"OO|n:subn", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "subn", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *repl;
PyObject *string;
Py_ssize_t count = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&repl, &string, &count)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
repl = args[0];
string = args[1];
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
count = ival;
}
skip_optional_pos:
return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count);
exit:
@ -520,7 +870,8 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"pattern", "flags", "code", "groups", "groupindex", "indexgroup", NULL};
static _PyArg_Parser _parser = {"OiO!nO!O!:compile", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0};
PyObject *argsbuf[6];
PyObject *pattern;
int flags;
PyObject *code;
@ -528,10 +879,52 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
PyObject *groupindex;
PyObject *indexgroup;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&pattern, &flags, &PyList_Type, &code, &groups, &PyDict_Type, &groupindex, &PyTuple_Type, &indexgroup)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 6, 6, 0, argsbuf);
if (!args) {
goto exit;
}
pattern = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
if (!PyList_Check(args[2])) {
_PyArg_BadArgument("compile", 3, "list", args[2]);
goto exit;
}
code = args[2];
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[3]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
groups = ival;
}
if (!PyDict_Check(args[4])) {
_PyArg_BadArgument("compile", 5, "dict", args[4]);
goto exit;
}
groupindex = args[4];
if (!PyTuple_Check(args[5])) {
_PyArg_BadArgument("compile", 6, "tuple", args[5]);
goto exit;
}
indexgroup = args[5];
return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup);
exit:
@ -555,13 +948,15 @@ _sre_SRE_Match_expand(MatchObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"template", NULL};
static _PyArg_Parser _parser = {"O:expand", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "expand", 0};
PyObject *argsbuf[1];
PyObject *template;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&template)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
template = args[0];
return_value = _sre_SRE_Match_expand_impl(self, template);
exit:
@ -588,13 +983,20 @@ _sre_SRE_Match_groups(MatchObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"default", NULL};
static _PyArg_Parser _parser = {"|O:groups", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "groups", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *default_value = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&default_value)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
default_value = args[0];
skip_optional_pos:
return_value = _sre_SRE_Match_groups_impl(self, default_value);
exit:
@ -621,13 +1023,20 @@ _sre_SRE_Match_groupdict(MatchObject *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"default", NULL};
static _PyArg_Parser _parser = {"|O:groupdict", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "groupdict", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *default_value = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&default_value)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
default_value = args[0];
skip_optional_pos:
return_value = _sre_SRE_Match_groupdict_impl(self, default_value);
exit:
@ -798,4 +1207,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{
return _sre_SRE_Scanner_search_impl(self);
}
/*[clinic end generated code: output=8d19359d6a4a3a7e input=a9049054013a1b77]*/
/*[clinic end generated code: output=67b702da5bdc9cac input=a9049054013a1b77]*/

248
Modules/clinic/_ssl.c.h generated
View file

@ -340,13 +340,32 @@ _ssl__SSLSocket_get_channel_binding(PySSLSocket *self, PyObject *const *args, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cb_type", NULL};
static _PyArg_Parser _parser = {"|s:get_channel_binding", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get_channel_binding", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *cb_type = "tls-unique";
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&cb_type)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("get_channel_binding", 1, "str", args[0]);
goto exit;
}
Py_ssize_t cb_type_length;
cb_type = PyUnicode_AsUTF8AndSize(args[0], &cb_type_length);
if (cb_type == NULL) {
goto exit;
}
if (strlen(cb_type) != (size_t)cb_type_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
skip_optional_pos:
return_value = _ssl__SSLSocket_get_channel_binding_impl(self, cb_type);
exit:
@ -548,15 +567,29 @@ _ssl__SSLContext_load_cert_chain(PySSLContext *self, PyObject *const *args, Py_s
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"certfile", "keyfile", "password", NULL};
static _PyArg_Parser _parser = {"O|OO:load_cert_chain", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "load_cert_chain", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *certfile;
PyObject *keyfile = NULL;
PyObject *password = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&certfile, &keyfile, &password)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
certfile = args[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
keyfile = args[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
password = args[2];
skip_optional_pos:
return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password);
exit:
@ -582,15 +615,34 @@ _ssl__SSLContext_load_verify_locations(PySSLContext *self, PyObject *const *args
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"cafile", "capath", "cadata", NULL};
static _PyArg_Parser _parser = {"|OOO:load_verify_locations", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "load_verify_locations", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *cafile = NULL;
PyObject *capath = NULL;
PyObject *cadata = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&cafile, &capath, &cadata)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
cafile = args[0];
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[1]) {
capath = args[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
cadata = args[2];
skip_optional_pos:
return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata);
exit:
@ -624,17 +676,54 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sock", "server_side", "server_hostname", "owner", "session", NULL};
static _PyArg_Parser _parser = {"O!i|O$OO:_wrap_socket", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_socket", 0};
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *sock;
int server_side;
PyObject *hostname_obj = Py_None;
PyObject *owner = Py_None;
PyObject *session = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj, &owner, &session)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyObject_TypeCheck(args[0], PySocketModule.Sock_Type)) {
_PyArg_BadArgument("_wrap_socket", 1, (PySocketModule.Sock_Type)->tp_name, args[0]);
goto exit;
}
sock = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
server_side = _PyLong_AsInt(args[1]);
if (server_side == -1 && PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[2]) {
hostname_obj = args[2];
if (!--noptargs) {
goto skip_optional_pos;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[3]) {
owner = args[3];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
session = args[4];
skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj, owner, session);
exit:
@ -661,7 +750,9 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"incoming", "outgoing", "server_side", "server_hostname", "owner", "session", NULL};
static _PyArg_Parser _parser = {"O!O!i|O$OO:_wrap_bio", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "_wrap_bio", 0};
PyObject *argsbuf[6];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
PySSLMemoryBIO *incoming;
PySSLMemoryBIO *outgoing;
int server_side;
@ -669,10 +760,50 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
PyObject *owner = Py_None;
PyObject *session = Py_None;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj, &owner, &session)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 4, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyObject_TypeCheck(args[0], &PySSLMemoryBIO_Type)) {
_PyArg_BadArgument("_wrap_bio", 1, (&PySSLMemoryBIO_Type)->tp_name, args[0]);
goto exit;
}
incoming = (PySSLMemoryBIO *)args[0];
if (!PyObject_TypeCheck(args[1], &PySSLMemoryBIO_Type)) {
_PyArg_BadArgument("_wrap_bio", 2, (&PySSLMemoryBIO_Type)->tp_name, args[1]);
goto exit;
}
outgoing = (PySSLMemoryBIO *)args[1];
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
server_side = _PyLong_AsInt(args[2]);
if (server_side == -1 && PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[3]) {
hostname_obj = args[3];
if (!--noptargs) {
goto skip_optional_pos;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[4]) {
owner = args[4];
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
session = args[5];
skip_optional_kwonly:
return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj, owner, session);
exit:
@ -772,13 +903,23 @@ _ssl__SSLContext_get_ca_certs(PySSLContext *self, PyObject *const *args, Py_ssiz
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"binary_form", NULL};
static _PyArg_Parser _parser = {"|p:get_ca_certs", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get_ca_certs", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int binary_form = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&binary_form)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
binary_form = PyObject_IsTrue(args[0]);
if (binary_form < 0) {
goto exit;
}
skip_optional_pos:
return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form);
exit:
@ -1131,14 +1272,37 @@ _ssl_txt2obj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"txt", "name", NULL};
static _PyArg_Parser _parser = {"s|p:txt2obj", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "txt2obj", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
const char *txt;
int name = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&txt, &name)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("txt2obj", 1, "str", args[0]);
goto exit;
}
Py_ssize_t txt_length;
txt = PyUnicode_AsUTF8AndSize(args[0], &txt_length);
if (txt == NULL) {
goto exit;
}
if (strlen(txt) != (size_t)txt_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
name = PyObject_IsTrue(args[1]);
if (name < 0) {
goto exit;
}
skip_optional_pos:
return_value = _ssl_txt2obj_impl(module, txt, name);
exit:
@ -1203,11 +1367,25 @@ _ssl_enum_certificates(PyObject *module, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
static _PyArg_Parser _parser = {"s:enum_certificates", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "enum_certificates", 0};
PyObject *argsbuf[1];
const char *store_name;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&store_name)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("enum_certificates", 1, "str", args[0]);
goto exit;
}
Py_ssize_t store_name_length;
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
if (store_name == NULL) {
goto exit;
}
if (strlen(store_name) != (size_t)store_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_certificates_impl(module, store_name);
@ -1242,11 +1420,25 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"store_name", NULL};
static _PyArg_Parser _parser = {"s:enum_crls", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "enum_crls", 0};
PyObject *argsbuf[1];
const char *store_name;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&store_name)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("enum_crls", 1, "str", args[0]);
goto exit;
}
Py_ssize_t store_name_length;
store_name = PyUnicode_AsUTF8AndSize(args[0], &store_name_length);
if (store_name == NULL) {
goto exit;
}
if (strlen(store_name) != (size_t)store_name_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
return_value = _ssl_enum_crls_impl(module, store_name);
@ -1284,4 +1476,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
/*[clinic end generated code: output=ac3fb15ca27500f2 input=a9049054013a1b77]*/
/*[clinic end generated code: output=a399d0eb393b6fab input=a9049054013a1b77]*/

View file

@ -21,13 +21,17 @@ Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
static const char * const _keywords[] = {"format", NULL};
static _PyArg_Parser _parser = {"O:Struct", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "Struct", 0};
PyObject *argsbuf[1];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *format;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&format)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
if (!fastargs) {
goto exit;
}
format = fastargs[0];
return_value = Struct___init___impl((PyStructObject *)self, format);
exit:
@ -100,14 +104,44 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"buffer", "offset", NULL};
static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "unpack_from", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&buffer, &offset)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &buffer, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
_PyArg_BadArgument("unpack_from", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
offset = ival;
}
skip_optional_pos:
return_value = Struct_unpack_from_impl(self, &buffer, offset);
exit:
@ -257,15 +291,48 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "buffer", "offset", NULL};
static _PyArg_Parser _parser = {"O&y*|n:unpack_from", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "unpack_from", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyStructObject *s_object = NULL;
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
cache_struct_converter, &s_object, &buffer, &offset)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (!cache_struct_converter(args[0], &s_object)) {
goto exit;
}
if (PyObject_GetBuffer(args[1], &buffer, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&buffer, 'C')) {
_PyArg_BadArgument("unpack_from", 2, "contiguous buffer", args[1]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
offset = ival;
}
skip_optional_pos:
return_value = unpack_from_impl(module, s_object, &buffer, offset);
exit:
@ -319,4 +386,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=ac595db9d2b271aa input=a9049054013a1b77]*/
/*[clinic end generated code: output=b642e1002d25ebdd input=a9049054013a1b77]*/

View file

@ -50,14 +50,36 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "backtick", NULL};
static _PyArg_Parser _parser = {"y*|$i:b2a_uu", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "b2a_uu", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int backtick = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &backtick)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("b2a_uu", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
backtick = _PyLong_AsInt(args[1]);
if (backtick == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_kwonly:
return_value = binascii_b2a_uu_impl(module, &data, backtick);
exit:
@ -117,14 +139,36 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "newline", NULL};
static _PyArg_Parser _parser = {"y*|$i:b2a_base64", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "b2a_base64", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int newline = 1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &newline)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("b2a_base64", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
newline = _PyLong_AsInt(args[1]);
if (newline == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_kwonly:
return_value = binascii_b2a_base64_impl(module, &data, newline);
exit:
@ -548,14 +592,32 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "header", NULL};
static _PyArg_Parser _parser = {"O&|i:a2b_qp", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "a2b_qp", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int header = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
ascii_buffer_converter, &data, &header)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!ascii_buffer_converter(args[0], &data)) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
header = _PyLong_AsInt(args[1]);
if (header == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = binascii_a2b_qp_impl(module, &data, header);
exit:
@ -588,16 +650,66 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL};
static _PyArg_Parser _parser = {"y*|iii:b2a_qp", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "b2a_qp", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int quotetabs = 0;
int istext = 1;
int header = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &quotetabs, &istext, &header)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("b2a_qp", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
quotetabs = _PyLong_AsInt(args[1]);
if (quotetabs == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
istext = _PyLong_AsInt(args[2]);
if (istext == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
header = _PyLong_AsInt(args[3]);
if (header == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
exit:
@ -608,4 +720,4 @@ exit:
return return_value;
}
/*[clinic end generated code: output=7210a01a718da4a0 input=a9049054013a1b77]*/
/*[clinic end generated code: output=a4a38e162605aca2 input=a9049054013a1b77]*/

View file

@ -897,17 +897,44 @@ cmath_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
static _PyArg_Parser _parser = {"DD|$dd:isclose", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "isclose", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
Py_complex a;
Py_complex b;
double rel_tol = 1e-09;
double abs_tol = 0.0;
int _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&a, &b, &rel_tol, &abs_tol)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
a = PyComplex_AsCComplex(args[0]);
if (PyErr_Occurred()) {
goto exit;
}
b = PyComplex_AsCComplex(args[1]);
if (PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[2]) {
rel_tol = PyFloat_AsDouble(args[2]);
if (PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
abs_tol = PyFloat_AsDouble(args[3]);
if (PyErr_Occurred()) {
goto exit;
}
skip_optional_kwonly:
_return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -917,4 +944,4 @@ cmath_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
/*[clinic end generated code: output=86a365d23f34aaff input=a9049054013a1b77]*/
/*[clinic end generated code: output=c7afb866e593fa45 input=a9049054013a1b77]*/

View file

@ -89,14 +89,29 @@ gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"generation", NULL};
static _PyArg_Parser _parser = {"|i:collect", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "collect", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int generation = NUM_GENERATIONS - 1;
Py_ssize_t _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&generation)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
generation = _PyLong_AsInt(args[0]);
if (generation == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
_return_value = gc_collect_impl(module, generation);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -238,13 +253,22 @@ gc_get_objects(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"generation", NULL};
static _PyArg_Parser _parser = {"|O&:get_objects", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "get_objects", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
Py_ssize_t generation = -1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
_Py_convert_optional_to_ssize_t, &generation)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (!_Py_convert_optional_to_ssize_t(args[0], &generation)) {
goto exit;
}
skip_optional_pos:
return_value = gc_get_objects_impl(module, generation);
exit:
@ -349,4 +373,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
/*[clinic end generated code: output=d692bf475f0bb096 input=a9049054013a1b77]*/
/*[clinic end generated code: output=e40d384b1f0d513c input=a9049054013a1b77]*/

View file

@ -21,13 +21,15 @@ grp_getgrgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"id", NULL};
static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "getgrgid", 0};
PyObject *argsbuf[1];
PyObject *id;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&id)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
id = args[0];
return_value = grp_getgrgid_impl(module, id);
exit:
@ -53,13 +55,22 @@ grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"name", NULL};
static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "getgrnam", 0};
PyObject *argsbuf[1];
PyObject *name;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&name)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!PyUnicode_Check(args[0])) {
_PyArg_BadArgument("getgrnam", 1, "str", args[0]);
goto exit;
}
if (PyUnicode_READY(args[0]) == -1) {
goto exit;
}
name = args[0];
return_value = grp_getgrnam_impl(module, name);
exit:
@ -86,4 +97,4 @@ grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return grp_getgrall_impl(module);
}
/*[clinic end generated code: output=ab10233f6015bc0a input=a9049054013a1b77]*/
/*[clinic end generated code: output=2aa6c60873d41ee8 input=a9049054013a1b77]*/

View file

@ -23,14 +23,24 @@ itertools_groupby(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "key", NULL};
static _PyArg_Parser _parser = {"O|O:groupby", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "groupby", 0};
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) - 1;
PyObject *it;
PyObject *keyfunc = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&it, &keyfunc)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
it = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
keyfunc = fastargs[1];
skip_optional_pos:
return_value = itertools_groupby_impl(type, it, keyfunc);
exit:
@ -334,14 +344,35 @@ itertools_combinations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
static _PyArg_Parser _parser = {"On:combinations", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "combinations", 0};
PyObject *argsbuf[2];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *iterable;
Py_ssize_t r;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&iterable, &r)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
iterable = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
r = ival;
}
return_value = itertools_combinations_impl(type, iterable, r);
exit:
@ -366,14 +397,35 @@ itertools_combinations_with_replacement(PyTypeObject *type, PyObject *args, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
static _PyArg_Parser _parser = {"On:combinations_with_replacement", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "combinations_with_replacement", 0};
PyObject *argsbuf[2];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *iterable;
Py_ssize_t r;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&iterable, &r)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
iterable = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
r = ival;
}
return_value = itertools_combinations_with_replacement_impl(type, iterable, r);
exit:
@ -397,14 +449,24 @@ itertools_permutations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "r", NULL};
static _PyArg_Parser _parser = {"O|O:permutations", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "permutations", 0};
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) - 1;
PyObject *iterable;
PyObject *robj = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&iterable, &robj)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
iterable = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
robj = fastargs[1];
skip_optional_pos:
return_value = itertools_permutations_impl(type, iterable, robj);
exit:
@ -426,15 +488,35 @@ itertools_accumulate(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"iterable", "func", "initial", NULL};
static _PyArg_Parser _parser = {"O|O$O:accumulate", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "accumulate", 0};
PyObject *argsbuf[3];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
PyObject *iterable;
PyObject *binop = Py_None;
PyObject *initial = Py_None;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&iterable, &binop, &initial)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
iterable = fastargs[0];
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[1]) {
binop = fastargs[1];
if (!--noptargs) {
goto skip_optional_pos;
}
}
skip_optional_pos:
if (!noptargs) {
goto skip_optional_kwonly;
}
initial = fastargs[2];
skip_optional_kwonly:
return_value = itertools_accumulate_impl(type, iterable, binop, initial);
exit:
@ -458,14 +540,19 @@ itertools_compress(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"data", "selectors", NULL};
static _PyArg_Parser _parser = {"OO:compress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "compress", 0};
PyObject *argsbuf[2];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *seq1;
PyObject *seq2;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&seq1, &seq2)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
seq1 = fastargs[0];
seq2 = fastargs[1];
return_value = itertools_compress_impl(type, seq1, seq2);
exit:
@ -527,17 +614,32 @@ itertools_count(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"start", "step", NULL};
static _PyArg_Parser _parser = {"|OO:count", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "count", 0};
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;
PyObject *long_cnt = NULL;
PyObject *long_step = NULL;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&long_cnt, &long_step)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[0]) {
long_cnt = fastargs[0];
if (!--noptargs) {
goto skip_optional_pos;
}
}
long_step = fastargs[1];
skip_optional_pos:
return_value = itertools_count_impl(type, long_cnt, long_step);
exit:
return return_value;
}
/*[clinic end generated code: output=3d0ca69707b60715 input=a9049054013a1b77]*/
/*[clinic end generated code: output=04c49debcae96003 input=a9049054013a1b77]*/

View file

@ -536,17 +536,44 @@ math_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL};
static _PyArg_Parser _parser = {"dd|$dd:isclose", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "isclose", 0};
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
double a;
double b;
double rel_tol = 1e-09;
double abs_tol = 0.0;
int _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&a, &b, &rel_tol, &abs_tol)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
a = PyFloat_AsDouble(args[0]);
if (PyErr_Occurred()) {
goto exit;
}
b = PyFloat_AsDouble(args[1]);
if (PyErr_Occurred()) {
goto exit;
}
if (!noptargs) {
goto skip_optional_kwonly;
}
if (args[2]) {
rel_tol = PyFloat_AsDouble(args[2]);
if (PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_kwonly;
}
}
abs_tol = PyFloat_AsDouble(args[3]);
if (PyErr_Occurred()) {
goto exit;
}
skip_optional_kwonly:
_return_value = math_isclose_impl(module, a, b, rel_tol, abs_tol);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
@ -580,17 +607,25 @@ math_prod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "start", NULL};
static _PyArg_Parser _parser = {"O|$O:prod", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "prod", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *iterable;
PyObject *start = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&iterable, &start)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
iterable = args[0];
if (!noptargs) {
goto skip_optional_kwonly;
}
start = args[1];
skip_optional_kwonly:
return_value = math_prod_impl(module, iterable, start);
exit:
return return_value;
}
/*[clinic end generated code: output=20505690ca6fe402 input=a9049054013a1b77]*/
/*[clinic end generated code: output=96e71135dce41c48 input=a9049054013a1b77]*/

View file

@ -82,16 +82,23 @@ _md5_md5(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:md5", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "md5", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=83cb1aef575f13bc input=a9049054013a1b77]*/
/*[clinic end generated code: output=53133f08cf9095fc input=a9049054013a1b77]*/

File diff suppressed because it is too large Load diff

View file

@ -297,15 +297,68 @@ pyexpat_ParserCreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"encoding", "namespace_separator", "intern", NULL};
static _PyArg_Parser _parser = {"|zzO:ParserCreate", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "ParserCreate", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *encoding = NULL;
const char *namespace_separator = NULL;
PyObject *intern = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&encoding, &namespace_separator, &intern)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
if (args[0] == Py_None) {
encoding = NULL;
}
else if (PyUnicode_Check(args[0])) {
Py_ssize_t encoding_length;
encoding = PyUnicode_AsUTF8AndSize(args[0], &encoding_length);
if (encoding == NULL) {
goto exit;
}
if (strlen(encoding) != (size_t)encoding_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("ParserCreate", 1, "str or None", args[0]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[1]) {
if (args[1] == Py_None) {
namespace_separator = NULL;
}
else if (PyUnicode_Check(args[1])) {
Py_ssize_t namespace_separator_length;
namespace_separator = PyUnicode_AsUTF8AndSize(args[1], &namespace_separator_length);
if (namespace_separator == NULL) {
goto exit;
}
if (strlen(namespace_separator) != (size_t)namespace_separator_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
}
else {
_PyArg_BadArgument("ParserCreate", 2, "str or None", args[1]);
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
intern = args[2];
skip_optional_pos:
return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
exit:
@ -348,4 +401,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=0f18b756d82b78a5 input=a9049054013a1b77]*/
/*[clinic end generated code: output=e48f37d326956bdd input=a9049054013a1b77]*/

View file

@ -512,14 +512,45 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sizehint", "flags", NULL};
static _PyArg_Parser _parser = {"|ii:epoll", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "epoll", 0};
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 sizehint = -1;
int flags = 0;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&sizehint, &flags)) {
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
if (!fastargs) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (fastargs[0]) {
if (PyFloat_Check(fastargs[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
sizehint = _PyLong_AsInt(fastargs[0]);
if (sizehint == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(fastargs[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = select_epoll_impl(type, sizehint, flags);
exit:
@ -638,14 +669,32 @@ select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t na
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "eventmask", NULL};
static _PyArg_Parser _parser = {"O&|I:register", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "register", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
int fd;
unsigned int eventmask = EPOLLIN | EPOLLPRI | EPOLLOUT;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
fildes_converter, &fd, &eventmask)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!fildes_converter(args[0], &fd)) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = select_epoll_register_impl(self, fd, eventmask);
exit:
@ -679,12 +728,25 @@ select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t narg
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", "eventmask", NULL};
static _PyArg_Parser _parser = {"O&I:modify", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "modify", 0};
PyObject *argsbuf[2];
int fd;
unsigned int eventmask;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
fildes_converter, &fd, &eventmask)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!fildes_converter(args[0], &fd)) {
goto exit;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
}
return_value = select_epoll_modify_impl(self, fd, eventmask);
@ -717,11 +779,15 @@ select_epoll_unregister(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"fd", NULL};
static _PyArg_Parser _parser = {"O&:unregister", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "unregister", 0};
PyObject *argsbuf[1];
int fd;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
fildes_converter, &fd)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!fildes_converter(args[0], &fd)) {
goto exit;
}
return_value = select_epoll_unregister_impl(self, fd);
@ -761,14 +827,35 @@ select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"timeout", "maxevents", NULL};
static _PyArg_Parser _parser = {"|Oi:poll", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "poll", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *timeout_obj = Py_None;
int maxevents = -1;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&timeout_obj, &maxevents)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
timeout_obj = args[0];
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
maxevents = _PyLong_AsInt(args[1]);
if (maxevents == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = select_epoll_poll_impl(self, timeout_obj, maxevents);
exit:
@ -1128,4 +1215,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
/*[clinic end generated code: output=3e40b33a3294d03d input=a9049054013a1b77]*/
/*[clinic end generated code: output=03041f3d09b04a3d input=a9049054013a1b77]*/

View file

@ -82,16 +82,23 @@ _sha1_sha1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha1", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sha1", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=3bae85313ee5a3b5 input=a9049054013a1b77]*/
/*[clinic end generated code: output=1ae7e73ec84a27d5 input=a9049054013a1b77]*/

View file

@ -82,13 +82,20 @@ _sha256_sha256(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha256", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sha256", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _sha256_sha256_impl(module, string);
exit:
@ -112,16 +119,23 @@ _sha256_sha224(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha224", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sha224", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=fb208641d4bc3b5f input=a9049054013a1b77]*/
/*[clinic end generated code: output=c54d0956ec88409d input=a9049054013a1b77]*/

View file

@ -82,13 +82,20 @@ _sha512_sha512(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha512", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sha512", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _sha512_sha512_impl(module, string);
exit:
@ -112,16 +119,23 @@ _sha512_sha384(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"string", NULL};
static _PyArg_Parser _parser = {"|O:sha384", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "sha384", 0};
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *string = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&string)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
string = args[0];
skip_optional_pos:
return_value = _sha512_sha384_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=3706fa47bea06c0b input=a9049054013a1b77]*/
/*[clinic end generated code: output=580df4b667084a7e input=a9049054013a1b77]*/

View file

@ -24,14 +24,36 @@ zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "level", NULL};
static _PyArg_Parser _parser = {"y*|i:compress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "compress", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int level = Z_DEFAULT_COMPRESSION;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &level)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("compress", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
level = _PyLong_AsInt(args[1]);
if (level == -1 && PyErr_Occurred()) {
goto exit;
}
skip_optional_pos:
return_value = zlib_compress_impl(module, &data, level);
exit:
@ -68,15 +90,45 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "wbits", "bufsize", NULL};
static _PyArg_Parser _parser = {"y*|iO&:decompress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
PyObject *argsbuf[3];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
int wbits = MAX_WBITS;
Py_ssize_t bufsize = DEF_BUF_SIZE;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, &wbits, ssize_t_converter, &bufsize)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[1]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (!ssize_t_converter(args[2], &bufsize)) {
goto exit;
}
skip_optional_pos:
return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
exit:
@ -130,7 +182,9 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"level", "method", "wbits", "memLevel", "strategy", "zdict", NULL};
static _PyArg_Parser _parser = {"|iiiiiy*:compressobj", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "compressobj", 0};
PyObject *argsbuf[6];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int level = Z_DEFAULT_COMPRESSION;
int method = DEFLATED;
int wbits = MAX_WBITS;
@ -138,10 +192,91 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
int strategy = Z_DEFAULT_STRATEGY;
Py_buffer zdict = {NULL, NULL};
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&level, &method, &wbits, &memLevel, &strategy, &zdict)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 6, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
level = _PyLong_AsInt(args[0]);
if (level == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
method = _PyLong_AsInt(args[1]);
if (method == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[2]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[3]) {
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
memLevel = _PyLong_AsInt(args[3]);
if (memLevel == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (args[4]) {
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
strategy = _PyLong_AsInt(args[4]);
if (strategy == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
if (PyObject_GetBuffer(args[5], &zdict, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&zdict, 'C')) {
_PyArg_BadArgument("compressobj", 6, "contiguous buffer", args[5]);
goto exit;
}
skip_optional_pos:
return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict);
exit:
@ -176,14 +311,35 @@ zlib_decompressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"wbits", "zdict", NULL};
static _PyArg_Parser _parser = {"|iO:decompressobj", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decompressobj", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int wbits = MAX_WBITS;
PyObject *zdict = NULL;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&wbits, &zdict)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (args[0]) {
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[0]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
}
if (!--noptargs) {
goto skip_optional_pos;
}
}
zdict = args[1];
skip_optional_pos:
return_value = zlib_decompressobj_impl(module, wbits, zdict);
exit:
@ -262,14 +418,30 @@ zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t n
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "max_length", NULL};
static _PyArg_Parser _parser = {"y*|O&:decompress", _keywords, 0};
static _PyArg_Parser _parser = {NULL, _keywords, "decompress", 0};
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
Py_buffer data = {NULL, NULL};
Py_ssize_t max_length = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&data, ssize_t_converter, &max_length)) {
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
if (!args) {
goto exit;
}
if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
goto exit;
}
if (!PyBuffer_IsContiguous(&data, 'C')) {
_PyArg_BadArgument("decompress", 1, "contiguous buffer", args[0]);
goto exit;
}
if (!noptargs) {
goto skip_optional_pos;
}
if (!ssize_t_converter(args[1], &max_length)) {
goto exit;
}
skip_optional_pos:
return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
exit:
@ -613,4 +785,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
/*[clinic end generated code: output=b3acec2384f18782 input=a9049054013a1b77]*/
/*[clinic end generated code: output=feb079cebbbaacd6 input=a9049054013a1b77]*/