Python 3.7 METH_FASTCALL backport (#406)

This commit is contained in:
Gautham 2022-05-13 17:35:12 +05:30 committed by GitHub
parent fec396037a
commit 83b743cf96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 2949 additions and 3356 deletions

View file

@ -128,7 +128,7 @@ PyDoc_STRVAR(_io_open__doc__,
"opened in a binary mode.");
#define _IO_OPEN_METHODDEF \
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
{"open", (PyCFunction)_io_open, METH_FASTCALL|METH_KEYWORDS, _io_open__doc__},
static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
@ -159,4 +159,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
exit:
return return_value;
}
/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/
/*[clinic end generated code: output=a748395f9589de02 input=a9049054013a1b77]*/

View file

@ -98,7 +98,7 @@ static PyObject *
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
static PyObject *
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = 0;
@ -107,10 +107,6 @@ _io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *
&size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("peek", kwnames)) {
goto exit;
}
return_value = _io__Buffered_peek_impl(self, size);
exit:
@ -129,7 +125,7 @@ static PyObject *
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
static PyObject *
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -138,10 +134,6 @@ _io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *
_PyIO_ConvertSsize_t, &n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__Buffered_read_impl(self, n);
exit:
@ -248,7 +240,7 @@ static PyObject *
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
static PyObject *
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -257,10 +249,6 @@ _io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObje
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io__Buffered_readline_impl(self, size);
exit:
@ -279,7 +267,7 @@ static PyObject *
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
static PyObject *
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *targetobj;
@ -289,10 +277,6 @@ _io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *
&targetobj, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
exit:
@ -311,7 +295,7 @@ static PyObject *
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
static PyObject *
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *pos = Py_None;
@ -321,10 +305,6 @@ _io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObje
&pos)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io__Buffered_truncate_impl(self, pos);
exit:
@ -496,4 +476,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=c526190c51a616c8 input=a9049054013a1b77]*/
/*[clinic end generated code: output=5239e4eaff6306f3 input=a9049054013a1b77]*/

View file

@ -165,7 +165,7 @@ static PyObject *
_io_BytesIO_read_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -175,10 +175,6 @@ _io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_read_impl(self, arg);
exit:
@ -214,7 +210,7 @@ static PyObject *
_io_BytesIO_readline_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -224,10 +220,6 @@ _io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_readline_impl(self, arg);
exit:
@ -251,7 +243,7 @@ static PyObject *
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -261,10 +253,6 @@ _io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_readlines_impl(self, arg);
exit:
@ -322,7 +310,7 @@ static PyObject *
_io_BytesIO_truncate_impl(bytesio *self, PyObject *arg);
static PyObject *
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -332,10 +320,6 @@ _io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_truncate_impl(self, arg);
exit:
@ -361,7 +345,7 @@ static PyObject *
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
static PyObject *
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t pos;
@ -371,10 +355,6 @@ _io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_BytesIO_seek_impl(self, pos, whence);
exit:
@ -449,4 +429,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
/*[clinic end generated code: output=08139186b009ec47 input=a9049054013a1b77]*/
/*[clinic end generated code: output=c8184aac612e063e input=a9049054013a1b77]*/

View file

@ -209,7 +209,7 @@ static PyObject *
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
static PyObject *
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -218,10 +218,6 @@ _io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnam
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_FileIO_read_impl(self, size);
exit:
@ -285,7 +281,7 @@ static PyObject *
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
static PyObject *
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *pos;
@ -295,10 +291,6 @@ _io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnam
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_FileIO_seek_impl(self, pos, whence);
exit:
@ -343,7 +335,7 @@ static PyObject *
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
static PyObject *
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *posobj = NULL;
@ -353,10 +345,6 @@ _io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *k
&posobj)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_FileIO_truncate_impl(self, posobj);
exit:
@ -386,4 +374,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=034d782a0daa82bd input=a9049054013a1b77]*/
/*[clinic end generated code: output=9d282c5eb1399024 input=a9049054013a1b77]*/

View file

@ -181,7 +181,7 @@ static PyObject *
_io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
static PyObject *
_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t limit = -1;
@ -190,10 +190,6 @@ _io__IOBase_readline(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject
_PyIO_ConvertSsize_t, &limit)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io__IOBase_readline_impl(self, limit);
exit:
@ -217,7 +213,7 @@ static PyObject *
_io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
static PyObject *
_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t hint = -1;
@ -226,10 +222,6 @@ _io__IOBase_readlines(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObjec
_PyIO_ConvertSsize_t, &hint)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
goto exit;
}
return_value = _io__IOBase_readlines_impl(self, hint);
exit:
@ -256,7 +248,7 @@ static PyObject *
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
static PyObject *
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -265,10 +257,6 @@ _io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject
&n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__RawIOBase_read_impl(self, n);
exit:
@ -292,4 +280,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _io__RawIOBase_readall_impl(self);
}
/*[clinic end generated code: output=1bcece367fc7b0cd input=a9049054013a1b77]*/
/*[clinic end generated code: output=ec8a2ef87208ce4c input=a9049054013a1b77]*/

View file

@ -55,7 +55,7 @@ static PyObject *
_io_StringIO_read_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -65,10 +65,6 @@ _io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *k
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_StringIO_read_impl(self, arg);
exit:
@ -90,7 +86,7 @@ static PyObject *
_io_StringIO_readline_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -100,10 +96,6 @@ _io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObjec
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_StringIO_readline_impl(self, arg);
exit:
@ -127,7 +119,7 @@ static PyObject *
_io_StringIO_truncate_impl(stringio *self, PyObject *arg);
static PyObject *
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *arg = Py_None;
@ -137,10 +129,6 @@ _io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObjec
&arg)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_StringIO_truncate_impl(self, arg);
exit:
@ -166,7 +154,7 @@ static PyObject *
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
static PyObject *
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t pos;
@ -176,10 +164,6 @@ _io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *k
&pos, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_StringIO_seek_impl(self, pos, whence);
exit:
@ -306,4 +290,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{
return _io_StringIO_seekable_impl(self);
}
/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/
/*[clinic end generated code: output=d69e0df410070292 input=a9049054013a1b77]*/

View file

@ -47,7 +47,7 @@ PyDoc_STRVAR(_io_IncrementalNewlineDecoder_decode__doc__,
"\n");
#define _IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF \
{"decode", (PyCFunction)_io_IncrementalNewlineDecoder_decode, METH_FASTCALL, _io_IncrementalNewlineDecoder_decode__doc__},
{"decode", (PyCFunction)_io_IncrementalNewlineDecoder_decode, METH_FASTCALL|METH_KEYWORDS, _io_IncrementalNewlineDecoder_decode__doc__},
static PyObject *
_io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
@ -232,7 +232,7 @@ static PyObject *
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
static PyObject *
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t n = -1;
@ -241,10 +241,6 @@ _io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject
_PyIO_ConvertSsize_t, &n)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_read_impl(self, n);
exit:
@ -263,7 +259,7 @@ static PyObject *
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
static PyObject *
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -272,10 +268,6 @@ _io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyOb
&size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_readline_impl(self, size);
exit:
@ -294,7 +286,7 @@ static PyObject *
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
static PyObject *
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *cookieObj;
@ -304,10 +296,6 @@ _io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject
&cookieObj, &whence)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
exit:
@ -343,7 +331,7 @@ static PyObject *
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
static PyObject *
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *pos = Py_None;
@ -353,10 +341,6 @@ _io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyOb
&pos)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
goto exit;
}
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
exit:
@ -481,4 +465,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
/*[clinic end generated code: output=67eba50449900a96 input=a9049054013a1b77]*/
/*[clinic end generated code: output=eee57db91b6b0550 input=a9049054013a1b77]*/

View file

@ -186,7 +186,7 @@ static PyObject *
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
static PyObject *
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
Py_ssize_t size = -1;
@ -195,10 +195,6 @@ _io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs
_PyIO_ConvertSsize_t, &size)) {
goto exit;
}
if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
return_value = _io__WindowsConsoleIO_read_impl(self, size);
exit:
@ -257,4 +253,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
{
return _io__WindowsConsoleIO_isatty_impl(self);
}
/*[clinic end generated code: output=b097ceeb54d6e15e input=a9049054013a1b77]*/
/*[clinic end generated code: output=178c491c15ee794c input=a9049054013a1b77]*/