Commit 31913915 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

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

parent 2c0d3f45
......@@ -442,6 +442,11 @@ Optimizations
(Contributed by Stefan Behnel, Pablo Galindo Salgado, Raymond Hettinger,
Neil Schemenauer, and Serhiy Storchaka in :issue:`36012`.)
* Reduced an overhead of converting arguments passed to many builtin functions
and methods. This sped up calling some simple builtin functions and
methods up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`,
:issue:`35582` and :issue:`36127`.)
Build and C API Changes
=======================
......
......@@ -118,6 +118,18 @@ PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
...);
PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
struct _PyArg_Parser *, va_list);
PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
PyObject *const *args, Py_ssize_t nargs,
PyObject *kwargs, PyObject *kwnames,
struct _PyArg_Parser *parser,
int minpos, int maxpos, int minkw,
PyObject **buf);
#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
(((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
(minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
(minpos), (maxpos), (minkw), (buf)))
void _PyArg_Fini(void);
#endif /* Py_LIMITED_API */
......
This diff is collapsed.
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
......@@ -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]*/
This diff is collapsed.
......@@ -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]*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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]*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment