cosmopolitan/third_party/python/Modules/clinic/_struct.inc

278 lines
7.3 KiB
PHP
Raw Normal View History

Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(Struct___init____doc__,
"Struct(format)\n"
"--\n"
"\n"
"Create a compiled struct object.\n"
"\n"
"Return a new Struct object which writes and reads binary data according to\n"
"the format string.\n"
"\n"
"See help(struct) for more on format strings.");
static int
Struct___init___impl(PyStructObject *self, PyObject *format);
static int
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};
PyObject *format;
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
&format)) {
goto exit;
}
return_value = Struct___init___impl((PyStructObject *)self, format);
exit:
return return_value;
}
PyDoc_STRVAR(Struct_unpack__doc__,
"unpack($self, buffer, /)\n"
"--\n"
"\n"
"Return a tuple containing unpacked values.\n"
"\n"
"Unpack according to the format string Struct.format. The buffer\'s size\n"
"in bytes must be Struct.size.\n"
"\n"
"See help(struct) for more on format strings.");
#define STRUCT_UNPACK_METHODDEF \
{"unpack", (PyCFunction)Struct_unpack, METH_O, Struct_unpack__doc__},
static PyObject *
Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer);
static PyObject *
Struct_unpack(PyStructObject *self, PyObject *arg)
{
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
if (!PyArg_Parse(arg, "y*:unpack", &buffer)) {
goto exit;
}
return_value = Struct_unpack_impl(self, &buffer);
exit:
/* Cleanup for buffer */
if (buffer.obj) {
PyBuffer_Release(&buffer);
}
return return_value;
}
PyDoc_STRVAR(Struct_unpack_from__doc__,
"unpack_from($self, /, buffer, offset=0)\n"
"--\n"
"\n"
"Return a tuple containing unpacked values.\n"
"\n"
"Values are unpacked according to the format string Struct.format.\n"
"\n"
"The buffer\'s size in bytes, minus offset, must be at least Struct.size.\n"
"\n"
"See help(struct) for more on format strings.");
#define STRUCT_UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__},
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
static PyObject *
Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer,
Py_ssize_t offset);
static PyObject *
Struct_unpack_from(PyStructObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"buffer", "offset", NULL};
static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0};
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&buffer, &offset)) {
goto exit;
}
return_value = Struct_unpack_from_impl(self, &buffer, offset);
exit:
/* Cleanup for buffer */
if (buffer.obj) {
PyBuffer_Release(&buffer);
}
return return_value;
}
PyDoc_STRVAR(Struct_iter_unpack__doc__,
"iter_unpack($self, buffer, /)\n"
"--\n"
"\n"
"Return an iterator yielding tuples.\n"
"\n"
"Tuples are unpacked from the given bytes source, like a repeated\n"
"invocation of unpack_from().\n"
"\n"
"Requires that the bytes length be a multiple of the struct size.");
#define STRUCT_ITER_UNPACK_METHODDEF \
{"iter_unpack", (PyCFunction)Struct_iter_unpack, METH_O, Struct_iter_unpack__doc__},
PyDoc_STRVAR(_clearcache__doc__,
"_clearcache($module, /)\n"
"--\n"
"\n"
"Clear the internal cache.");
#define _CLEARCACHE_METHODDEF \
{"_clearcache", (PyCFunction)_clearcache, METH_NOARGS, _clearcache__doc__},
static PyObject *
_clearcache_impl(PyObject *module);
static PyObject *
_clearcache(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _clearcache_impl(module);
}
PyDoc_STRVAR(calcsize__doc__,
"calcsize($module, format, /)\n"
"--\n"
"\n"
"Return size in bytes of the struct described by the format string.");
#define CALCSIZE_METHODDEF \
{"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__},
PyDoc_STRVAR(unpack__doc__,
"unpack($module, format, inputstr, /)\n"
"--\n"
"\n"
"Return a tuple containing values unpacked according to the format string.\n"
"\n"
"The buffer\'s size in bytes must be calcsize(format).\n"
"\n"
"See help(struct) for more on format strings.");
#define UNPACK_METHODDEF \
{"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__},
static PyObject *
unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr);
static PyObject *
unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
{
PyObject *return_value = NULL;
PyObject *format;
PyObject *inputstr;
if (!_PyArg_UnpackStack(args, nargs, "unpack",
2, 2,
&format, &inputstr)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("unpack", kwnames)) {
goto exit;
}
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
return_value = unpack_impl(module, format, inputstr);
exit:
return return_value;
}
PyDoc_STRVAR(unpack_from__doc__,
"unpack_from($module, format, /, buffer, offset=0)\n"
"--\n"
"\n"
"Return a tuple containing values unpacked according to the format string.\n"
"\n"
"The buffer\'s size, minus offset, must be at least calcsize(format).\n"
"\n"
"See help(struct) for more on format strings.");
#define UNPACK_FROM_METHODDEF \
{"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__},
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
static PyObject *
unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer,
Py_ssize_t offset);
static PyObject *
unpack_from(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"", "buffer", "offset", NULL};
static _PyArg_Parser _parser = {"Oy*|n:unpack_from", _keywords, 0};
PyObject *format;
Py_buffer buffer = {NULL, NULL};
Py_ssize_t offset = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
&format, &buffer, &offset)) {
goto exit;
}
return_value = unpack_from_impl(module, format, &buffer, offset);
exit:
/* Cleanup for buffer */
if (buffer.obj) {
PyBuffer_Release(&buffer);
}
return return_value;
}
PyDoc_STRVAR(iter_unpack__doc__,
"iter_unpack($module, format, buffer, /)\n"
"--\n"
"\n"
"Return an iterator yielding tuples unpacked from the given bytes.\n"
"\n"
"The bytes are unpacked according to the format string, like\n"
"a repeated invocation of unpack_from().\n"
"\n"
"Requires that the bytes length be a multiple of the format struct size.");
#define ITER_UNPACK_METHODDEF \
{"iter_unpack", (PyCFunction)iter_unpack, METH_FASTCALL, iter_unpack__doc__},
static PyObject *
iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer);
static PyObject *
iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
{
PyObject *return_value = NULL;
PyObject *format;
PyObject *buffer;
if (!_PyArg_UnpackStack(args, nargs, "iter_unpack",
2, 2,
&format, &buffer)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) {
goto exit;
}
Backporting METH_FASTCALL from Python 3.7 (#317) * dict copy speedup refer to bpo-31179 or python/cpython@boa7a037b8fde * __build_class__() uses METH_FASTCALL refer python/cpython@69de71b2557 refer python/cpython@773dc6dd064 a single test related to __prepare__ fails. * type_prepare uses METH_FASTCALL refer python/cpython@d526cfe546 refer python/cpython@80ab22fa2c the prepare-related test still fails. It's just related to the error message format though. * separate into ParseStack and ParseStackAndKeywords refer python/cpython@6518a93cb1 refer python/cpython@3e1fad6913 refer python/cpython@c0083fc47d * Add _PyArg_NoStackKeywords refer python/cpython@29d39cc8f50 * _PyStack_UnpackDict now returns int refer python/cpython@998c20962c * METH_FASTCALL changes to .inc files done via python's Argument Clinic tool, refer python/cpython@259f0e4437 * Added _PyArg_UnpackStack refer python/cpython@fe54dda08 * Argument Clinic FASTCALL again refer python/cpython@0c4a828ca * Argument Clinic for ordered dictionary object refer python/cpython@b05cbac0527 * speed up getargs refer python/cpython@1741441649 * FASTCALL for sorted, next, and getattr refer python/cpython@5a60ecaa7a refer python/cpython@fda6d0acf0 refer python/cpython@84b388bb80 * Optimize methoddescr_call refer python/cpython@2a1b676d1f refer python/cpython@c52572319c refer python/cpython@35ecebe165 refer python/cpython@8128d5a491 * cleanup _PyMethodDef_RawFastCallDict refer python/cpython@0a2e46835d refer python/cpython@98ccba8344 refer python/cpython@c89ef828cf refer python/cpython@250e4b0063 * print now uses METH_FASTCALL refer python/cpython@c3858bd7c6 refer python/cpython@bd584f169f refer python/cpython@06d34393c2 * _struct module now uses Argument Clinic refer python/cpython@3f2d10132d * make deque methods faster refer python/cpython@dd407d50068 * recursive calls in PyObject_Call refer python/cpython@7399a05965 only partially ported, because RawFastCallKeywords hasn't been ported * add macros refer python/cpython@68a001dd59 * all tests pass in MODE=dbg * convert some internal functions to FASTCALL __import__ might need to be changed later, if it is possible to backport the METH_FASTCALL | METH_KEYWORDS flag distinction later. * speed up unpickling refer python/cpython@bee09aecc2c31 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a0e88 test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f0 _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
2021-11-12 23:26:57 +00:00
return_value = iter_unpack_impl(module, format, buffer);
exit:
return return_value;
}
/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/