bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)
This commit is contained in:
parent
2c0d3f4547
commit
3191391515
|
@ -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 */
|
||||
|
||||
|
|
1263
Lib/test/clinic.test
1263
Lib/test/clinic.test
File diff suppressed because it is too large
Load Diff
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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, "etabs, &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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -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]*/
|
||||
|
|
|
@ -62,14 +62,22 @@ bytearray_translate(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t n
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"", "delete", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:translate", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "translate", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *table;
|
||||
PyObject *deletechars = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&table, &deletechars)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
table = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
deletechars = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = bytearray_translate_impl(self, table, deletechars);
|
||||
|
||||
exit:
|
||||
|
@ -239,14 +247,43 @@ bytearray_split(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On: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) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = bytearray_split_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -314,14 +351,43 @@ bytearray_rsplit(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "rsplit", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = bytearray_rsplit_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -654,14 +720,51 @@ bytearray_decode(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"encoding", "errors", NULL};
|
||||
static _PyArg_Parser _parser = {"|ss: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) - 0;
|
||||
const char *encoding = NULL;
|
||||
const char *errors = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&encoding, &errors)) {
|
||||
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 (!PyUnicode_Check(args[0])) {
|
||||
_PyArg_BadArgument("decode", 1, "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("decode", 2, "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytearray_decode_impl(self, encoding, errors);
|
||||
|
||||
exit:
|
||||
|
@ -701,13 +804,28 @@ bytearray_splitlines(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"keepends", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "splitlines", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int keepends = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&keepends)) {
|
||||
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;
|
||||
}
|
||||
keepends = _PyLong_AsInt(args[0]);
|
||||
if (keepends == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytearray_splitlines_impl(self, keepends);
|
||||
|
||||
exit:
|
||||
|
@ -824,4 +942,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return bytearray_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=f4353c27dcb4a13d input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=272fcb836b92da32 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -27,14 +27,43 @@ bytes_split(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On: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) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = bytes_split_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -154,14 +183,43 @@ bytes_rsplit(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "rsplit", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = bytes_rsplit_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -309,14 +367,22 @@ bytes_translate(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, Py
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"", "delete", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:translate", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "translate", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *table;
|
||||
PyObject *deletechars = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&table, &deletechars)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
table = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
deletechars = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = bytes_translate_impl(self, table, deletechars);
|
||||
|
||||
exit:
|
||||
|
@ -487,14 +553,51 @@ bytes_decode(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"encoding", "errors", NULL};
|
||||
static _PyArg_Parser _parser = {"|ss: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) - 0;
|
||||
const char *encoding = NULL;
|
||||
const char *errors = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&encoding, &errors)) {
|
||||
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 (!PyUnicode_Check(args[0])) {
|
||||
_PyArg_BadArgument("decode", 1, "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("decode", 2, "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytes_decode_impl(self, encoding, errors);
|
||||
|
||||
exit:
|
||||
|
@ -521,13 +624,28 @@ bytes_splitlines(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, P
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"keepends", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "splitlines", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int keepends = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&keepends)) {
|
||||
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;
|
||||
}
|
||||
keepends = _PyLong_AsInt(args[0]);
|
||||
if (keepends == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = bytes_splitlines_impl(self, keepends);
|
||||
|
||||
exit:
|
||||
|
@ -568,4 +686,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=c6621bda84e63e51 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=af9f51b9b185567d input=a9049054013a1b77]*/
|
||||
|
|
|
@ -18,17 +18,32 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"real", "imag", NULL};
|
||||
static _PyArg_Parser _parser = {"|OO:complex", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "complex", 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 *r = _PyLong_Zero;
|
||||
PyObject *i = NULL;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&r, &i)) {
|
||||
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]) {
|
||||
r = fastargs[0];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
i = fastargs[1];
|
||||
skip_optional_pos:
|
||||
return_value = complex_new_impl(type, r, i);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=5017b2458bdc4ecd input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a0fe23fdbdc9b06b input=a9049054013a1b77]*/
|
||||
|
|
|
@ -10,13 +10,17 @@ mappingproxy_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"mapping", NULL};
|
||||
static _PyArg_Parser _parser = {"O:mappingproxy", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "mappingproxy", 0};
|
||||
PyObject *argsbuf[1];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
PyObject *mapping;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&mapping)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
mapping = fastargs[0];
|
||||
return_value = mappingproxy_new_impl(type, mapping);
|
||||
|
||||
exit:
|
||||
|
@ -69,19 +73,46 @@ property_init(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
int return_value = -1;
|
||||
static const char * const _keywords[] = {"fget", "fset", "fdel", "doc", NULL};
|
||||
static _PyArg_Parser _parser = {"|OOOO:property", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "property", 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) - 0;
|
||||
PyObject *fget = NULL;
|
||||
PyObject *fset = NULL;
|
||||
PyObject *fdel = NULL;
|
||||
PyObject *doc = NULL;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&fget, &fset, &fdel, &doc)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 4, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
if (fastargs[0]) {
|
||||
fget = fastargs[0];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (fastargs[1]) {
|
||||
fset = fastargs[1];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (fastargs[2]) {
|
||||
fdel = fastargs[2];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
doc = fastargs[3];
|
||||
skip_optional_pos:
|
||||
return_value = property_init_impl((propertyobject *)self, fget, fset, fdel, doc);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=729021fa9cdc46be input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=916624e717862abc input=a9049054013a1b77]*/
|
||||
|
|
|
@ -25,14 +25,24 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"iterable", "start", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:enumerate", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "enumerate", 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 *start = 0;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&iterable, &start)) {
|
||||
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;
|
||||
}
|
||||
start = fastargs[1];
|
||||
skip_optional_pos:
|
||||
return_value = enum_new_impl(type, iterable, start);
|
||||
|
||||
exit:
|
||||
|
@ -67,4 +77,4 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=831cec3db0e987c9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=e18c3fefcf914ec7 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -28,20 +28,51 @@ func_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"code", "globals", "name", "argdefs", "closure", NULL};
|
||||
static _PyArg_Parser _parser = {"O!O!|OOO:function", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "function", 0};
|
||||
PyObject *argsbuf[5];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 2;
|
||||
PyCodeObject *code;
|
||||
PyObject *globals;
|
||||
PyObject *name = Py_None;
|
||||
PyObject *defaults = Py_None;
|
||||
PyObject *closure = Py_None;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&PyCode_Type, &code, &PyDict_Type, &globals, &name, &defaults, &closure)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 5, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyObject_TypeCheck(fastargs[0], &PyCode_Type)) {
|
||||
_PyArg_BadArgument("function", 1, (&PyCode_Type)->tp_name, fastargs[0]);
|
||||
goto exit;
|
||||
}
|
||||
code = (PyCodeObject *)fastargs[0];
|
||||
if (!PyDict_Check(fastargs[1])) {
|
||||
_PyArg_BadArgument("function", 2, "dict", fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
globals = fastargs[1];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
if (fastargs[2]) {
|
||||
name = fastargs[2];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (fastargs[3]) {
|
||||
defaults = fastargs[3];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
closure = fastargs[4];
|
||||
skip_optional_pos:
|
||||
return_value = func_new_impl(type, code, globals, name, defaults, closure);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a6ab29e4dd33010a input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=1d01072cd5620d7e input=a9049054013a1b77]*/
|
||||
|
|
|
@ -169,14 +169,35 @@ list_sort(PyListObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "reverse", NULL};
|
||||
static _PyArg_Parser _parser = {"|$Oi:sort", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "sort", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
PyObject *keyfunc = Py_None;
|
||||
int reverse = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&keyfunc, &reverse)) {
|
||||
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]) {
|
||||
keyfunc = args[0];
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
}
|
||||
if (PyFloat_Check(args[1])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
reverse = _PyLong_AsInt(args[1]);
|
||||
if (reverse == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = list_sort_impl(self, keyfunc, reverse);
|
||||
|
||||
exit:
|
||||
|
@ -338,4 +359,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return list___reversed___impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=4a835f9880a72273 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d1d5078edb7d3cf4 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -10,14 +10,29 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"", "base", NULL};
|
||||
static _PyArg_Parser _parser = {"|OO:int", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "int", 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 *x = NULL;
|
||||
PyObject *obase = NULL;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&x, &obase)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
if (nargs < 1) {
|
||||
goto skip_optional_posonly;
|
||||
}
|
||||
noptargs--;
|
||||
x = fastargs[0];
|
||||
skip_optional_posonly:
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
obase = fastargs[1];
|
||||
skip_optional_pos:
|
||||
return_value = long_new_impl(type, x, obase);
|
||||
|
||||
exit:
|
||||
|
@ -183,15 +198,50 @@ int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"length", "byteorder", "signed", NULL};
|
||||
static _PyArg_Parser _parser = {"nU|$p:to_bytes", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "to_bytes", 0};
|
||||
PyObject *argsbuf[3];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
|
||||
Py_ssize_t length;
|
||||
PyObject *byteorder;
|
||||
int is_signed = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&length, &byteorder, &is_signed)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(args[0])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
{
|
||||
Py_ssize_t ival = -1;
|
||||
PyObject *iobj = PyNumber_Index(args[0]);
|
||||
if (iobj != NULL) {
|
||||
ival = PyLong_AsSsize_t(iobj);
|
||||
Py_DECREF(iobj);
|
||||
}
|
||||
if (ival == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
length = ival;
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("to_bytes", 2, "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
byteorder = args[1];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
is_signed = PyObject_IsTrue(args[2]);
|
||||
if (is_signed < 0) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = int_to_bytes_impl(self, length, byteorder, is_signed);
|
||||
|
||||
exit:
|
||||
|
@ -230,18 +280,37 @@ int_from_bytes(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"bytes", "byteorder", "signed", NULL};
|
||||
static _PyArg_Parser _parser = {"OU|$p:from_bytes", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "from_bytes", 0};
|
||||
PyObject *argsbuf[3];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
|
||||
PyObject *bytes_obj;
|
||||
PyObject *byteorder;
|
||||
int is_signed = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&bytes_obj, &byteorder, &is_signed)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
bytes_obj = args[0];
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("from_bytes", 2, "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(args[1]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
byteorder = args[1];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_kwonly;
|
||||
}
|
||||
is_signed = PyObject_IsTrue(args[2]);
|
||||
if (is_signed < 0) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_kwonly:
|
||||
return_value = int_from_bytes_impl(type, bytes_obj, byteorder, is_signed);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=3b91cda9d83abaa2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=709503897c55bca1 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -18,17 +18,34 @@ module___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
int return_value = -1;
|
||||
static const char * const _keywords[] = {"name", "doc", NULL};
|
||||
static _PyArg_Parser _parser = {"U|O:module", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "module", 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 *name;
|
||||
PyObject *doc = Py_None;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&name, &doc)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyUnicode_Check(fastargs[0])) {
|
||||
_PyArg_BadArgument("module", 1, "str", fastargs[0]);
|
||||
goto exit;
|
||||
}
|
||||
if (PyUnicode_READY(fastargs[0]) == -1) {
|
||||
goto exit;
|
||||
}
|
||||
name = fastargs[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
doc = fastargs[1];
|
||||
skip_optional_pos:
|
||||
return_value = module___init___impl((PyModuleObject *)self, name, doc);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=7b1b324bf6a590d1 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d7b7ca1237597b08 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -19,14 +19,22 @@ OrderedDict_fromkeys(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"iterable", "value", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:fromkeys", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "fromkeys", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *seq;
|
||||
PyObject *value = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&seq, &value)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
seq = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
value = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = OrderedDict_fromkeys_impl(type, seq, value);
|
||||
|
||||
exit:
|
||||
|
@ -53,14 +61,22 @@ OrderedDict_setdefault(PyODictObject *self, PyObject *const *args, Py_ssize_t na
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "default", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:setdefault", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "setdefault", 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 = OrderedDict_setdefault_impl(self, key, default_value);
|
||||
|
||||
exit:
|
||||
|
@ -86,13 +102,23 @@ OrderedDict_popitem(PyODictObject *self, PyObject *const *args, Py_ssize_t nargs
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"last", NULL};
|
||||
static _PyArg_Parser _parser = {"|p:popitem", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "popitem", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int last = 1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&last)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
last = PyObject_IsTrue(args[0]);
|
||||
if (last < 0) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = OrderedDict_popitem_impl(self, last);
|
||||
|
||||
exit:
|
||||
|
@ -118,17 +144,28 @@ OrderedDict_move_to_end(PyODictObject *self, PyObject *const *args, Py_ssize_t n
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "last", NULL};
|
||||
static _PyArg_Parser _parser = {"O|p:move_to_end", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "move_to_end", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *key;
|
||||
int last = 1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&key, &last)) {
|
||||
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;
|
||||
}
|
||||
last = PyObject_IsTrue(args[1]);
|
||||
if (last < 0) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = OrderedDict_move_to_end_impl(self, key, last);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=f6f189e1fe032e0b input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=8eb1296df9142908 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -10,17 +10,27 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sequence", "dict", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:structseq", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "structseq", 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 *arg;
|
||||
PyObject *dict = NULL;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&arg, &dict)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
arg = fastargs[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
dict = fastargs[1];
|
||||
skip_optional_pos:
|
||||
return_value = structseq_new_impl(type, arg, dict);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=cd643eb89b5d312a input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ed3019acf49b656c input=a9049054013a1b77]*/
|
||||
|
|
|
@ -142,14 +142,51 @@ unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"encoding", "errors", NULL};
|
||||
static _PyArg_Parser _parser = {"|ss: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) - 0;
|
||||
const char *encoding = NULL;
|
||||
const char *errors = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&encoding, &errors)) {
|
||||
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 (!PyUnicode_Check(args[0])) {
|
||||
_PyArg_BadArgument("encode", 1, "str", args[0]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (!PyUnicode_Check(args[1])) {
|
||||
_PyArg_BadArgument("encode", 2, "str", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
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;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = unicode_encode_impl(self, encoding, errors);
|
||||
|
||||
exit:
|
||||
|
@ -175,13 +212,28 @@ unicode_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"tabsize", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:expandtabs", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int tabsize = 8;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&tabsize)) {
|
||||
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;
|
||||
}
|
||||
tabsize = _PyLong_AsInt(args[0]);
|
||||
if (tabsize == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = unicode_expandtabs_impl(self, tabsize);
|
||||
|
||||
exit:
|
||||
|
@ -781,14 +833,43 @@ unicode_split(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On: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) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = unicode_split_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -854,14 +935,43 @@ unicode_rsplit(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sep", "maxsplit", NULL};
|
||||
static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "rsplit", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
PyObject *sep = Py_None;
|
||||
Py_ssize_t maxsplit = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sep, &maxsplit)) {
|
||||
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]) {
|
||||
sep = 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 = unicode_rsplit_impl(self, sep, maxsplit);
|
||||
|
||||
exit:
|
||||
|
@ -888,13 +998,28 @@ unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"keepends", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "splitlines", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int keepends = 0;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&keepends)) {
|
||||
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;
|
||||
}
|
||||
keepends = _PyLong_AsInt(args[0]);
|
||||
if (keepends == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = unicode_splitlines_impl(self, keepends);
|
||||
|
||||
exit:
|
||||
|
@ -1107,4 +1232,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return unicode_sizeof_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=087ff163a10505ae input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d1541724cb4a0070 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -21,13 +21,28 @@ stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, Py
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"tabsize", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:expandtabs", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int tabsize = 8;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&tabsize)) {
|
||||
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;
|
||||
}
|
||||
tabsize = _PyLong_AsInt(args[0]);
|
||||
if (tabsize == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = stringlib_expandtabs_impl(self, tabsize);
|
||||
|
||||
exit:
|
||||
|
@ -259,4 +274,4 @@ stringlib_zfill(PyObject *self, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=787248a980f6a00e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=96cbb19b238d0e84 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -22,14 +22,21 @@ _testconsole_write_input(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"file", "s", NULL};
|
||||
static _PyArg_Parser _parser = {"OS:write_input", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "write_input", 0};
|
||||
PyObject *argsbuf[2];
|
||||
PyObject *file;
|
||||
PyBytesObject *s;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&file, &s)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
file = args[0];
|
||||
if (!PyBytes_Check(args[1])) {
|
||||
_PyArg_BadArgument("write_input", 2, "bytes", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
s = (PyBytesObject *)args[1];
|
||||
return_value = _testconsole_write_input_impl(module, file, s);
|
||||
|
||||
exit:
|
||||
|
@ -57,13 +64,15 @@ _testconsole_read_output(PyObject *module, PyObject *const *args, Py_ssize_t nar
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"file", NULL};
|
||||
static _PyArg_Parser _parser = {"O:read_output", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "read_output", 0};
|
||||
PyObject *argsbuf[1];
|
||||
PyObject *file;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&file)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
file = args[0];
|
||||
return_value = _testconsole_read_output_impl(module, file);
|
||||
|
||||
exit:
|
||||
|
@ -79,4 +88,4 @@ exit:
|
|||
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
||||
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
||||
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
|
||||
/*[clinic end generated code: output=ab9ea8e78d26288e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ef452d5fb9287fc2 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -88,15 +88,19 @@ winreg_HKEYType___exit__(PyHKEYObject *self, PyObject *const *args, Py_ssize_t n
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"exc_type", "exc_value", "traceback", NULL};
|
||||
static _PyArg_Parser _parser = {"OOO:__exit__", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "__exit__", 0};
|
||||
PyObject *argsbuf[3];
|
||||
PyObject *exc_type;
|
||||
PyObject *exc_value;
|
||||
PyObject *traceback;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&exc_type, &exc_value, &traceback)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
exc_type = args[0];
|
||||
exc_value = args[1];
|
||||
traceback = args[2];
|
||||
return_value = winreg_HKEYType___exit___impl(self, exc_type, exc_value, traceback);
|
||||
|
||||
exit:
|
||||
|
@ -1117,4 +1121,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=bd491131d343ae7a input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=1204d20c543b5b4a input=a9049054013a1b77]*/
|
||||
|
|
|
@ -24,12 +24,23 @@ winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"sound", "flags", NULL};
|
||||
static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "PlaySound", 0};
|
||||
PyObject *argsbuf[2];
|
||||
PyObject *sound;
|
||||
int flags;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&sound, &flags)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
sound = 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;
|
||||
}
|
||||
return_value = winsound_PlaySound_impl(module, sound, flags);
|
||||
|
@ -61,12 +72,31 @@ winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"frequency", "duration", NULL};
|
||||
static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "Beep", 0};
|
||||
PyObject *argsbuf[2];
|
||||
int frequency;
|
||||
int duration;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&frequency, &duration)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(args[0])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
frequency = _PyLong_AsInt(args[0]);
|
||||
if (frequency == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(args[1])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
duration = _PyLong_AsInt(args[1]);
|
||||
if (duration == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = winsound_Beep_impl(module, frequency, duration);
|
||||
|
@ -94,16 +124,31 @@ winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"type", NULL};
|
||||
static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "MessageBeep", 0};
|
||||
PyObject *argsbuf[1];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
|
||||
int type = MB_OK;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&type)) {
|
||||
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;
|
||||
}
|
||||
type = _PyLong_AsInt(args[0]);
|
||||
if (type == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = winsound_MessageBeep_impl(module, type);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=19e5f0fb15bcd5bc input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/
|
||||
|
|
|
@ -20,19 +20,55 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL};
|
||||
static _PyArg_Parser _parser = {"O|OnO:warn", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "warn", 0};
|
||||
PyObject *argsbuf[4];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *message;
|
||||
PyObject *category = Py_None;
|
||||
Py_ssize_t stacklevel = 1;
|
||||
PyObject *source = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&message, &category, &stacklevel, &source)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
message = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
if (args[1]) {
|
||||
category = args[1];
|
||||
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;
|
||||
}
|
||||
{
|
||||
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;
|
||||
}
|
||||
stacklevel = ival;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
source = args[3];
|
||||
skip_optional_pos:
|
||||
return_value = warnings_warn_impl(module, message, category, stacklevel, source);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a4fbe6e2d1cc2091 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/
|
||||
|
|
|
@ -180,7 +180,9 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", "feature_version", NULL};
|
||||
static _PyArg_Parser _parser = {"OO&s|iiii:compile", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "compile", 0};
|
||||
PyObject *argsbuf[7];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3;
|
||||
PyObject *source;
|
||||
PyObject *filename;
|
||||
const char *mode;
|
||||
|
@ -189,10 +191,82 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
|
|||
int optimize = -1;
|
||||
int feature_version = -1;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize, &feature_version)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 7, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
source = args[0];
|
||||
if (!PyUnicode_FSDecoder(args[1], &filename)) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyUnicode_Check(args[2])) {
|
||||
_PyArg_BadArgument("compile", 3, "str", args[2]);
|
||||
goto exit;
|
||||
}
|
||||
Py_ssize_t mode_length;
|
||||
mode = PyUnicode_AsUTF8AndSize(args[2], &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[3]) {
|
||||
if (PyFloat_Check(args[3])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
flags = _PyLong_AsInt(args[3]);
|
||||
if (flags == -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;
|
||||
}
|
||||
dont_inherit = _PyLong_AsInt(args[4]);
|
||||
if (dont_inherit == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (args[5]) {
|
||||
if (PyFloat_Check(args[5])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
optimize = _PyLong_AsInt(args[5]);
|
||||
if (optimize == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
if (!--noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
}
|
||||
if (PyFloat_Check(args[6])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
feature_version = _PyLong_AsInt(args[6]);
|
||||
if (feature_version == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
skip_optional_pos:
|
||||
return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize, feature_version);
|
||||
|
||||
exit:
|
||||
|
@ -637,14 +711,22 @@ builtin_round(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"number", "ndigits", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:round", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "round", 0};
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *number;
|
||||
PyObject *ndigits = NULL;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&number, &ndigits)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
number = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
ndigits = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = builtin_round_impl(module, number, ndigits);
|
||||
|
||||
exit:
|
||||
|
@ -672,14 +754,22 @@ builtin_sum(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"", "start", NULL};
|
||||
static _PyArg_Parser _parser = {"O|O:sum", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "sum", 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, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
iterable = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
start = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = builtin_sum_impl(module, iterable, start);
|
||||
|
||||
exit:
|
||||
|
@ -755,4 +845,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=00b97a48ea49eaf2 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=3f690311ac556c31 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -411,12 +411,29 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"key", "source", NULL};
|
||||
static _PyArg_Parser _parser = {"ly*:source_hash", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "source_hash", 0};
|
||||
PyObject *argsbuf[2];
|
||||
long key;
|
||||
Py_buffer source = {NULL, NULL};
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&key, &source)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(args[0])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
key = PyLong_AsLong(args[0]);
|
||||
if (key == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyObject_GetBuffer(args[1], &source, PyBUF_SIMPLE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
if (!PyBuffer_IsContiguous(&source, 'C')) {
|
||||
_PyArg_BadArgument("source_hash", 2, "contiguous buffer", args[1]);
|
||||
goto exit;
|
||||
}
|
||||
return_value = _imp_source_hash_impl(module, key, &source);
|
||||
|
@ -437,4 +454,4 @@ exit:
|
|||
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
|
||||
#define _IMP_EXEC_DYNAMIC_METHODDEF
|
||||
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
|
||||
/*[clinic end generated code: output=2409b8feeafe7c4b input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b51244770fdcf4b8 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -410,11 +410,21 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args,
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"depth", NULL};
|
||||
static _PyArg_Parser _parser = {"i:set_coroutine_origin_tracking_depth", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "set_coroutine_origin_tracking_depth", 0};
|
||||
PyObject *argsbuf[1];
|
||||
int depth;
|
||||
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&depth)) {
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(args[0])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
depth = _PyLong_AsInt(args[0]);
|
||||
if (depth == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth);
|
||||
|
@ -1050,4 +1060,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=109787af3401cd27 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=3ba4c194d00f1866 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -17,14 +17,41 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
PyObject *return_value = NULL;
|
||||
static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL};
|
||||
static _PyArg_Parser _parser = {"OO!ii:TracebackType", _keywords, 0};
|
||||
static _PyArg_Parser _parser = {NULL, _keywords, "TracebackType", 0};
|
||||
PyObject *argsbuf[4];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
PyObject *tb_next;
|
||||
PyFrameObject *tb_frame;
|
||||
int tb_lasti;
|
||||
int tb_lineno;
|
||||
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
&tb_next, &PyFrame_Type, &tb_frame, &tb_lasti, &tb_lineno)) {
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
tb_next = fastargs[0];
|
||||
if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
|
||||
_PyArg_BadArgument("TracebackType", 2, (&PyFrame_Type)->tp_name, fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
tb_frame = (PyFrameObject *)fastargs[1];
|
||||
if (PyFloat_Check(fastargs[2])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
tb_lasti = _PyLong_AsInt(fastargs[2]);
|
||||
if (tb_lasti == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
if (PyFloat_Check(fastargs[3])) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer argument expected, got float" );
|
||||
goto exit;
|
||||
}
|
||||
tb_lineno = _PyLong_AsInt(fastargs[3]);
|
||||
if (tb_lineno == -1 && PyErr_Occurred()) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno);
|
||||
|
@ -32,4 +59,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=0133130d7d19556f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=7e4c0e252d0973b0 input=a9049054013a1b77]*/
|
||||
|
|
330
Python/getargs.c
330
Python/getargs.c
|
@ -1905,24 +1905,11 @@ parser_init(struct _PyArg_Parser *parser)
|
|||
int i, len, min, max, nkw;
|
||||
PyObject *kwtuple;
|
||||
|
||||
assert(parser->format != NULL);
|
||||
assert(parser->keywords != NULL);
|
||||
if (parser->kwtuple != NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* grab the function name or custom error msg first (mutually exclusive) */
|
||||
parser->fname = strchr(parser->format, ':');
|
||||
if (parser->fname) {
|
||||
parser->fname++;
|
||||
parser->custom_msg = NULL;
|
||||
}
|
||||
else {
|
||||
parser->custom_msg = strchr(parser->format,';');
|
||||
if (parser->custom_msg)
|
||||
parser->custom_msg++;
|
||||
}
|
||||
|
||||
keywords = parser->keywords;
|
||||
/* scan keywords and count the number of positional-only parameters */
|
||||
for (i = 0; keywords[i] && !*keywords[i]; i++) {
|
||||
|
@ -1938,59 +1925,73 @@ parser_init(struct _PyArg_Parser *parser)
|
|||
}
|
||||
len = i;
|
||||
|
||||
min = max = INT_MAX;
|
||||
format = parser->format;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (*format == '|') {
|
||||
if (min != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string (| specified twice)");
|
||||
return 0;
|
||||
}
|
||||
if (max != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string ($ before |)");
|
||||
return 0;
|
||||
}
|
||||
min = i;
|
||||
format++;
|
||||
if (format) {
|
||||
/* grab the function name or custom error msg first (mutually exclusive) */
|
||||
parser->fname = strchr(parser->format, ':');
|
||||
if (parser->fname) {
|
||||
parser->fname++;
|
||||
parser->custom_msg = NULL;
|
||||
}
|
||||
if (*format == '$') {
|
||||
if (max != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string ($ specified twice)");
|
||||
return 0;
|
||||
}
|
||||
if (i < parser->pos) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Empty parameter name after $");
|
||||
return 0;
|
||||
}
|
||||
max = i;
|
||||
format++;
|
||||
else {
|
||||
parser->custom_msg = strchr(parser->format,';');
|
||||
if (parser->custom_msg)
|
||||
parser->custom_msg++;
|
||||
}
|
||||
if (IS_END_OF_FORMAT(*format)) {
|
||||
|
||||
min = max = INT_MAX;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (*format == '|') {
|
||||
if (min != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string (| specified twice)");
|
||||
return 0;
|
||||
}
|
||||
if (max != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string ($ before |)");
|
||||
return 0;
|
||||
}
|
||||
min = i;
|
||||
format++;
|
||||
}
|
||||
if (*format == '$') {
|
||||
if (max != INT_MAX) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Invalid format string ($ specified twice)");
|
||||
return 0;
|
||||
}
|
||||
if (i < parser->pos) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"Empty parameter name after $");
|
||||
return 0;
|
||||
}
|
||||
max = i;
|
||||
format++;
|
||||
}
|
||||
if (IS_END_OF_FORMAT(*format)) {
|
||||
PyErr_Format(PyExc_SystemError,
|
||||
"More keyword list entries (%d) than "
|
||||
"format specifiers (%d)", len, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
msg = skipitem(&format, NULL, 0);
|
||||
if (msg) {
|
||||
PyErr_Format(PyExc_SystemError, "%s: '%s'", msg,
|
||||
format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
parser->min = Py_MIN(min, len);
|
||||
parser->max = Py_MIN(max, len);
|
||||
|
||||
if (!IS_END_OF_FORMAT(*format) && (*format != '|') && (*format != '$')) {
|
||||
PyErr_Format(PyExc_SystemError,
|
||||
"More keyword list entries (%d) than "
|
||||
"format specifiers (%d)", len, i);
|
||||
"more argument specifiers than keyword list entries "
|
||||
"(remaining format:'%s')", format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
msg = skipitem(&format, NULL, 0);
|
||||
if (msg) {
|
||||
PyErr_Format(PyExc_SystemError, "%s: '%s'", msg,
|
||||
format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
parser->min = Py_MIN(min, len);
|
||||
parser->max = Py_MIN(max, len);
|
||||
|
||||
if (!IS_END_OF_FORMAT(*format) && (*format != '|') && (*format != '$')) {
|
||||
PyErr_Format(PyExc_SystemError,
|
||||
"more argument specifiers than keyword list entries "
|
||||
"(remaining format:'%s')", format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nkw = len - parser->pos;
|
||||
|
@ -2313,6 +2314,215 @@ vgetargskeywordsfast(PyObject *args, PyObject *keywords,
|
|||
}
|
||||
|
||||
|
||||
#undef _PyArg_UnpackKeywords
|
||||
|
||||
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)
|
||||
{
|
||||
PyObject *kwtuple;
|
||||
PyObject *keyword;
|
||||
int i, posonly, minposonly, maxargs;
|
||||
int reqlimit = minkw ? maxpos + minkw : minpos;
|
||||
Py_ssize_t nkwargs;
|
||||
PyObject *current_arg;
|
||||
PyObject * const *kwstack = NULL;
|
||||
|
||||
assert(kwargs == NULL || PyDict_Check(kwargs));
|
||||
assert(kwargs == NULL || kwnames == NULL);
|
||||
|
||||
if (parser == NULL) {
|
||||
PyErr_BadInternalCall();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (kwnames != NULL && !PyTuple_Check(kwnames)) {
|
||||
PyErr_BadInternalCall();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (args == NULL && nargs == 0) {
|
||||
args = buf;
|
||||
}
|
||||
|
||||
if (!parser_init(parser)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
kwtuple = parser->kwtuple;
|
||||
posonly = parser->pos;
|
||||
minposonly = Py_MIN(posonly, minpos);
|
||||
maxargs = posonly + (int)PyTuple_GET_SIZE(kwtuple);
|
||||
|
||||
if (kwargs != NULL) {
|
||||
nkwargs = PyDict_GET_SIZE(kwargs);
|
||||
}
|
||||
else if (kwnames != NULL) {
|
||||
nkwargs = PyTuple_GET_SIZE(kwnames);
|
||||
kwstack = args + nargs;
|
||||
}
|
||||
else {
|
||||
nkwargs = 0;
|
||||
}
|
||||
if (nkwargs == 0 && minkw == 0 && minpos <= nargs && nargs <= maxpos) {
|
||||
/* Fast path. */
|
||||
return args;
|
||||
}
|
||||
if (nargs + nkwargs > maxargs) {
|
||||
/* Adding "keyword" (when nargs == 0) prevents producing wrong error
|
||||
messages in some special cases (see bpo-31229). */
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s%s takes at most %d %sargument%s (%zd given)",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()",
|
||||
maxargs,
|
||||
(nargs == 0) ? "keyword " : "",
|
||||
(maxargs == 1) ? "" : "s",
|
||||
nargs + nkwargs);
|
||||
return NULL;
|
||||
}
|
||||
if (nargs > maxpos) {
|
||||
if (maxpos == 0) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s%s takes no positional arguments",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()");
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s%s takes %s %d positional argument%s (%zd given)",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()",
|
||||
(minpos < maxpos) ? "at most" : "exactly",
|
||||
maxpos,
|
||||
(maxpos == 1) ? "" : "s",
|
||||
nargs);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if (nargs < minposonly) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%.200s%s takes %s %d positional argument%s"
|
||||
" (%zd given)",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()",
|
||||
minposonly < maxpos ? "at least" : "exactly",
|
||||
minposonly,
|
||||
minposonly == 1 ? "" : "s",
|
||||
nargs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* copy tuple args */
|
||||
for (i = 0; i < nargs; i++) {
|
||||
buf[i] = args[i];
|
||||
}
|
||||
|
||||
/* copy keyword args using kwtuple to drive process */
|
||||
for (i = Py_MAX(nargs, posonly); i < maxargs; i++) {
|
||||
if (nkwargs) {
|
||||
keyword = PyTuple_GET_ITEM(kwtuple, i - posonly);
|
||||
if (kwargs != NULL) {
|
||||
current_arg = PyDict_GetItemWithError(kwargs, keyword);
|
||||
if (!current_arg && PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
current_arg = find_keyword(kwnames, kwstack, keyword);
|
||||
}
|
||||
}
|
||||
else if (i >= reqlimit) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
current_arg = NULL;
|
||||
}
|
||||
|
||||
buf[i] = current_arg;
|
||||
|
||||
if (current_arg) {
|
||||
--nkwargs;
|
||||
}
|
||||
else if (i < minpos || (maxpos <= i && i < reqlimit)) {
|
||||
/* Less arguments than required */
|
||||
keyword = PyTuple_GET_ITEM(kwtuple, i - posonly);
|
||||
PyErr_Format(PyExc_TypeError, "%.200s%s missing required "
|
||||
"argument '%U' (pos %d)",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()",
|
||||
keyword, i+1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (nkwargs > 0) {
|
||||
Py_ssize_t j;
|
||||
/* make sure there are no arguments given by name and position */
|
||||
for (i = posonly; i < nargs; i++) {
|
||||
keyword = PyTuple_GET_ITEM(kwtuple, i - posonly);
|
||||
if (kwargs != NULL) {
|
||||
current_arg = PyDict_GetItemWithError(kwargs, keyword);
|
||||
if (!current_arg && PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
current_arg = find_keyword(kwnames, kwstack, keyword);
|
||||
}
|
||||
if (current_arg) {
|
||||
/* arg present in tuple and in dict */
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"argument for %.200s%s given by name ('%U') "
|
||||
"and position (%d)",
|
||||
(parser->fname == NULL) ? "function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()",
|
||||
keyword, i+1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* make sure there are no extraneous keyword arguments */
|
||||
j = 0;
|
||||
while (1) {
|
||||
int match;
|
||||
if (kwargs != NULL) {
|
||||
if (!PyDict_Next(kwargs, &j, &keyword, NULL))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (j >= PyTuple_GET_SIZE(kwnames))
|
||||
break;
|
||||
keyword = PyTuple_GET_ITEM(kwnames, j);
|
||||
j++;
|
||||
}
|
||||
|
||||
if (!PyUnicode_Check(keyword)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"keywords must be strings");
|
||||
return NULL;
|
||||
}
|
||||
match = PySequence_Contains(kwtuple, keyword);
|
||||
if (match <= 0) {
|
||||
if (!match) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"'%U' is an invalid keyword "
|
||||
"argument for %.200s%s",
|
||||
keyword,
|
||||
(parser->fname == NULL) ? "this function" : parser->fname,
|
||||
(parser->fname == NULL) ? "" : "()");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
skipitem(const char **p_format, va_list *p_va, int flags)
|
||||
{
|
||||
|
|
|
@ -645,10 +645,21 @@ class CLanguage(Language):
|
|||
default_return_converter = (not f.return_converter or
|
||||
f.return_converter.type == 'PyObject *')
|
||||
|
||||
positional = parameters and parameters[-1].is_positional_only()
|
||||
|
||||
new_or_init = f.kind in (METHOD_NEW, METHOD_INIT)
|
||||
|
||||
pos_only = min_pos = max_pos = min_kw_only = 0
|
||||
for i, p in enumerate(parameters, 1):
|
||||
if p.is_keyword_only():
|
||||
assert not p.is_positional_only()
|
||||
if not p.is_optional():
|
||||
min_kw_only = i - max_pos
|
||||
else:
|
||||
max_pos = i
|
||||
if p.is_positional_only():
|
||||
pos_only = i
|
||||
if not p.is_optional():
|
||||
min_pos = i
|
||||
|
||||
meth_o = (len(parameters) == 1 and
|
||||
parameters[0].is_positional_only() and
|
||||
not converters[0].is_optional() and
|
||||
|
@ -712,16 +723,19 @@ class CLanguage(Language):
|
|||
# parser_body_fields remembers the fields passed in to the
|
||||
# previous call to parser_body. this is used for an awful hack.
|
||||
parser_body_fields = ()
|
||||
def parser_body(prototype, *fields):
|
||||
nonlocal parser_body_fields
|
||||
parser_body_declarations = ''
|
||||
def parser_body(prototype, *fields, declarations=''):
|
||||
nonlocal parser_body_fields, parser_body_declarations
|
||||
add, output = text_accumulator()
|
||||
add(prototype)
|
||||
parser_body_fields = fields
|
||||
parser_body_declarations = declarations
|
||||
|
||||
fields = list(fields)
|
||||
fields.insert(0, normalize_snippet("""
|
||||
{{
|
||||
{return_value_declaration}
|
||||
{parser_declarations}
|
||||
{declarations}
|
||||
{initializers}
|
||||
""") + "\n")
|
||||
|
@ -739,13 +753,7 @@ class CLanguage(Language):
|
|||
for field in fields:
|
||||
add('\n')
|
||||
add(field)
|
||||
return output()
|
||||
|
||||
def insert_keywords(s):
|
||||
return linear_format(s, declarations=
|
||||
'static const char * const _keywords[] = {{{keywords}, NULL}};\n'
|
||||
'static _PyArg_Parser _parser = {{"{format_units}:{name}", _keywords, 0}};\n'
|
||||
'{declarations}')
|
||||
return linear_format(output(), parser_declarations=declarations)
|
||||
|
||||
if not parameters:
|
||||
# no parameters, METH_NOARGS
|
||||
|
@ -818,7 +826,7 @@ class CLanguage(Language):
|
|||
|
||||
parser_definition = parser_body(parser_prototype, ' {option_group_parsing}')
|
||||
|
||||
elif positional:
|
||||
elif pos_only == len(parameters):
|
||||
if not new_or_init:
|
||||
# positional-only, but no option groups
|
||||
# we only need one call to _PyArg_ParseStack
|
||||
|
@ -836,15 +844,19 @@ class CLanguage(Language):
|
|||
nargs = 'PyTuple_GET_SIZE(args)'
|
||||
argname_fmt = 'PyTuple_GET_ITEM(args, %d)'
|
||||
|
||||
parser_code = []
|
||||
parser_code = [normalize_snippet("""
|
||||
if (!_PyArg_CheckPositional("{name}", %s, %d, %d)) {{
|
||||
goto exit;
|
||||
}}
|
||||
""" % (nargs, min_pos, max_pos), indent=4)]
|
||||
has_optional = False
|
||||
for i, converter in enumerate(converters):
|
||||
parsearg = converter.parse_arg(argname_fmt % i, i + 1)
|
||||
for i, p in enumerate(parameters):
|
||||
parsearg = p.converter.parse_arg(argname_fmt % i, i + 1)
|
||||
if parsearg is None:
|
||||
#print('Cannot convert %s %r for %s' % (converter.__class__.__name__, converter.format_unit, converter.name), file=sys.stderr)
|
||||
#print('Cannot convert %s %r for %s' % (p.converter.__class__.__name__, p.converter.format_unit, p.converter.name), file=sys.stderr)
|
||||
parser_code = None
|
||||
break
|
||||
if has_optional or converter.default is not unspecified:
|
||||
if has_optional or p.is_optional():
|
||||
has_optional = True
|
||||
parser_code.append(normalize_snippet("""
|
||||
if (%s < %d) {{
|
||||
|
@ -854,11 +866,6 @@ class CLanguage(Language):
|
|||
parser_code.append(normalize_snippet(parsearg, indent=4))
|
||||
|
||||
if parser_code is not None:
|
||||
parser_code.insert(0, normalize_snippet("""
|
||||
if (!_PyArg_CheckPositional("{name}", %s, {unpack_min}, {unpack_max})) {{
|
||||
goto exit;
|
||||
}}
|
||||
""" % nargs, indent=4))
|
||||
if has_optional:
|
||||
parser_code.append("skip_optional:")
|
||||
else:
|
||||
|
@ -878,33 +885,122 @@ class CLanguage(Language):
|
|||
""", indent=4)]
|
||||
parser_definition = parser_body(parser_prototype, *parser_code)
|
||||
|
||||
elif not new_or_init:
|
||||
flags = "METH_FASTCALL|METH_KEYWORDS"
|
||||
|
||||
parser_prototype = parser_prototype_fastcall_keywords
|
||||
|
||||
body = normalize_snippet("""
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
{parse_arguments})) {{
|
||||
goto exit;
|
||||
}}
|
||||
""", indent=4)
|
||||
parser_definition = parser_body(parser_prototype, body)
|
||||
parser_definition = insert_keywords(parser_definition)
|
||||
else:
|
||||
# positional-or-keyword arguments
|
||||
flags = "METH_VARARGS|METH_KEYWORDS"
|
||||
has_optional_kw = (max(pos_only, min_pos) + min_kw_only < len(converters))
|
||||
if not new_or_init:
|
||||
flags = "METH_FASTCALL|METH_KEYWORDS"
|
||||
parser_prototype = parser_prototype_fastcall_keywords
|
||||
argname_fmt = 'args[%d]'
|
||||
declarations = normalize_snippet("""
|
||||
static const char * const _keywords[] = {{{keywords}, NULL}};
|
||||
static _PyArg_Parser _parser = {{NULL, _keywords, "{name}", 0}};
|
||||
PyObject *argsbuf[%s];
|
||||
""" % len(converters))
|
||||
if has_optional_kw:
|
||||
declarations += "\nPy_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - %d;" % (min_pos + min_kw_only)
|
||||
parser_code = [normalize_snippet("""
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, %d, %d, %d, argsbuf);
|
||||
if (!args) {{
|
||||
goto exit;
|
||||
}}
|
||||
""" % (min_pos, max_pos, min_kw_only), indent=4)]
|
||||
else:
|
||||
# positional-or-keyword arguments
|
||||
flags = "METH_VARARGS|METH_KEYWORDS"
|
||||
parser_prototype = parser_prototype_keyword
|
||||
argname_fmt = 'fastargs[%d]'
|
||||
declarations = normalize_snippet("""
|
||||
static const char * const _keywords[] = {{{keywords}, NULL}};
|
||||
static _PyArg_Parser _parser = {{NULL, _keywords, "{name}", 0}};
|
||||
PyObject *argsbuf[%s];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
""" % len(converters))
|
||||
if has_optional_kw:
|
||||
declarations += "\nPy_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - %d;" % (min_pos + min_kw_only)
|
||||
parser_code = [normalize_snippet("""
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, %d, %d, %d, argsbuf);
|
||||
if (!fastargs) {{
|
||||
goto exit;
|
||||
}}
|
||||
""" % (min_pos, max_pos, min_kw_only), indent=4)]
|
||||
|
||||
parser_prototype = parser_prototype_keyword
|
||||
add_label = None
|
||||
for i, p in enumerate(parameters):
|
||||
parsearg = p.converter.parse_arg(argname_fmt % i, i + 1)
|
||||
if parsearg is None:
|
||||
#print('Cannot convert %s %r for %s' % (p.converter.__class__.__name__, p.converter.format_unit, p.converter.name), file=sys.stderr)
|
||||
parser_code = None
|
||||
break
|
||||
if add_label and (i == pos_only or i == max_pos):
|
||||
parser_code.append("%s:" % add_label)
|
||||
add_label = None
|
||||
if not p.is_optional():
|
||||
parser_code.append(normalize_snippet(parsearg, indent=4))
|
||||
elif i < pos_only:
|
||||
add_label = 'skip_optional_posonly'
|
||||
parser_code.append(normalize_snippet("""
|
||||
if (nargs < %d) {{
|
||||
goto %s;
|
||||
}}
|
||||
""" % (i + 1, add_label), indent=4))
|
||||
if has_optional_kw:
|
||||
parser_code.append(normalize_snippet("""
|
||||
noptargs--;
|
||||
""", indent=4))
|
||||
parser_code.append(normalize_snippet(parsearg, indent=4))
|
||||
else:
|
||||
if i < max_pos:
|
||||
label = 'skip_optional_pos'
|
||||
first_opt = max(min_pos, pos_only)
|
||||
else:
|
||||
label = 'skip_optional_kwonly'
|
||||
first_opt = max_pos + min_kw_only
|
||||
if i == first_opt:
|
||||
add_label = label
|
||||
parser_code.append(normalize_snippet("""
|
||||
if (!noptargs) {{
|
||||
goto %s;
|
||||
}}
|
||||
""" % add_label, indent=4))
|
||||
if i + 1 == len(parameters):
|
||||
parser_code.append(normalize_snippet(parsearg, indent=4))
|
||||
else:
|
||||
add_label = label
|
||||
parser_code.append(normalize_snippet("""
|
||||
if (%s) {{
|
||||
""" % (argname_fmt % i), indent=4))
|
||||
parser_code.append(normalize_snippet(parsearg, indent=8))
|
||||
parser_code.append(normalize_snippet("""
|
||||
if (!--noptargs) {{
|
||||
goto %s;
|
||||
}}
|
||||
}}
|
||||
""" % add_label, indent=4))
|
||||
|
||||
body = normalize_snippet("""
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
{parse_arguments})) {{
|
||||
goto exit;
|
||||
}}
|
||||
""", indent=4)
|
||||
parser_definition = parser_body(parser_prototype, body)
|
||||
parser_definition = insert_keywords(parser_definition)
|
||||
if parser_code is not None:
|
||||
if add_label:
|
||||
parser_code.append("%s:" % add_label)
|
||||
else:
|
||||
declarations = (
|
||||
'static const char * const _keywords[] = {{{keywords}, NULL}};\n'
|
||||
'static _PyArg_Parser _parser = {{"{format_units}:{name}", _keywords, 0}};')
|
||||
if not new_or_init:
|
||||
parser_code = [normalize_snippet("""
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
{parse_arguments})) {{
|
||||
goto exit;
|
||||
}}
|
||||
""", indent=4)]
|
||||
else:
|
||||
parser_code = [normalize_snippet("""
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
|
||||
{parse_arguments})) {{
|
||||
goto exit;
|
||||
}}
|
||||
""", indent=4)]
|
||||
parser_definition = parser_body(parser_prototype, *parser_code,
|
||||
declarations=declarations)
|
||||
|
||||
|
||||
if new_or_init:
|
||||
|
@ -938,9 +1034,8 @@ class CLanguage(Language):
|
|||
}}
|
||||
""", indent=4))
|
||||
|
||||
parser_definition = parser_body(parser_prototype, *fields)
|
||||
if parses_keywords:
|
||||
parser_definition = insert_keywords(parser_definition)
|
||||
parser_definition = parser_body(parser_prototype, *fields,
|
||||
declarations=parser_body_declarations)
|
||||
|
||||
|
||||
if flags in ('METH_NOARGS', 'METH_O', 'METH_VARARGS'):
|
||||
|
@ -2176,6 +2271,9 @@ class Parameter:
|
|||
def is_positional_only(self):
|
||||
return self.kind == inspect.Parameter.POSITIONAL_ONLY
|
||||
|
||||
def is_optional(self):
|
||||
return (self.default is not unspecified)
|
||||
|
||||
def copy(self, **overrides):
|
||||
kwargs = {
|
||||
'name': self.name, 'kind': self.kind, 'default':self.default,
|
||||
|
|
Loading…
Reference in New Issue