mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
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@69de71b255 refer python/cpython@773dc6dd06 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@29d39cc8f5 * _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@b05cbac052 * 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@dd407d5006 * 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@bee09aecc2 * added _PyMethodDef_RawFastCallKeywords refer python/cpython@7399a05965 * PyCFunction_Call performance refer python/cpython@12c5838dae * avoid PyMethodObject in slots main change in python/cpython@516b98161a test_exceptions changed in python/cpython@331bbe6aaa type_settattro changed in python/cpython@193f7e094f _PyObject_CallFunctionVa changed in python/cpython@fe4ff83049 * fix refcount error found in MODE=dbg all tests now pass in MODE=dbg
This commit is contained in:
parent
6f658f058b
commit
7fe9e70117
71 changed files with 4154 additions and 2450 deletions
|
@ -130,6 +130,11 @@ PyDoc_STRVAR(_io_open__doc__,
|
|||
#define _IO_OPEN_METHODDEF \
|
||||
{"open", (PyCFunction)_io_open, METH_FASTCALL, _io_open__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
|
||||
int buffering, const char *encoding, const char *errors,
|
||||
const char *newline, int closefd, PyObject *opener);
|
||||
|
||||
static PyObject *
|
||||
_io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
|
@ -145,7 +150,7 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
|||
int closefd = 1;
|
||||
PyObject *opener = Py_None;
|
||||
|
||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -154,4 +159,4 @@ _io_open(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=c5b8fc8b83102bbf input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=79fd04d9c9d8f28f input=a9049054013a1b77]*/
|
||||
|
|
|
@ -11,6 +11,8 @@ PyDoc_STRVAR(_io__BufferedIOBase_readinto__doc__,
|
|||
#define _IO__BUFFEREDIOBASE_READINTO_METHODDEF \
|
||||
{"readinto", (PyCFunction)_io__BufferedIOBase_readinto, METH_O, _io__BufferedIOBase_readinto__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__BufferedIOBase_readinto_impl(PyObject *self, Py_buffer *buffer);
|
||||
|
||||
static PyObject *
|
||||
_io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
|
||||
|
@ -90,21 +92,25 @@ PyDoc_STRVAR(_io__Buffered_peek__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__BUFFERED_PEEK_METHODDEF \
|
||||
{"peek", (PyCFunction)_io__Buffered_peek, METH_VARARGS, _io__Buffered_peek__doc__},
|
||||
{"peek", (PyCFunction)_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_peek(buffered *self, PyObject *args)
|
||||
_io__Buffered_peek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t size = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|n:peek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|n:peek",
|
||||
&size)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("peek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__Buffered_peek_impl(self, size);
|
||||
|
||||
exit:
|
||||
|
@ -117,21 +123,25 @@ PyDoc_STRVAR(_io__Buffered_read__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__BUFFERED_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io__Buffered_read, METH_VARARGS, _io__Buffered_read__doc__},
|
||||
{"read", (PyCFunction)_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_read(buffered *self, PyObject *args)
|
||||
_io__Buffered_read(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t n = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||
_PyIO_ConvertSsize_t, &n)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__Buffered_read_impl(self, n);
|
||||
|
||||
exit:
|
||||
|
@ -232,21 +242,25 @@ PyDoc_STRVAR(_io__Buffered_readline__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__BUFFERED_READLINE_METHODDEF \
|
||||
{"readline", (PyCFunction)_io__Buffered_readline, METH_VARARGS, _io__Buffered_readline__doc__},
|
||||
{"readline", (PyCFunction)_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_readline(buffered *self, PyObject *args)
|
||||
_io__Buffered_readline(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t size = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:readline",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
|
||||
_PyIO_ConvertSsize_t, &size)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__Buffered_readline_impl(self, size);
|
||||
|
||||
exit:
|
||||
|
@ -259,22 +273,26 @@ PyDoc_STRVAR(_io__Buffered_seek__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__BUFFERED_SEEK_METHODDEF \
|
||||
{"seek", (PyCFunction)_io__Buffered_seek, METH_VARARGS, _io__Buffered_seek__doc__},
|
||||
{"seek", (PyCFunction)_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_seek(buffered *self, PyObject *args)
|
||||
_io__Buffered_seek(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *targetobj;
|
||||
int whence = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||
&targetobj, &whence)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
|
||||
|
||||
exit:
|
||||
|
@ -287,22 +305,26 @@ PyDoc_STRVAR(_io__Buffered_truncate__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__BUFFERED_TRUNCATE_METHODDEF \
|
||||
{"truncate", (PyCFunction)_io__Buffered_truncate, METH_VARARGS, _io__Buffered_truncate__doc__},
|
||||
{"truncate", (PyCFunction)_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
|
||||
|
||||
static PyObject *
|
||||
_io__Buffered_truncate(buffered *self, PyObject *args)
|
||||
_io__Buffered_truncate(buffered *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *pos = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "truncate",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||
0, 1,
|
||||
&pos)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__Buffered_truncate_impl(self, pos);
|
||||
|
||||
exit:
|
||||
|
@ -474,4 +496,4 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=a956f394ecde4cf9 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c526190c51a616c8 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -159,22 +159,26 @@ PyDoc_STRVAR(_io_BytesIO_read__doc__,
|
|||
"Return an empty bytes object at EOF.");
|
||||
|
||||
#define _IO_BYTESIO_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io_BytesIO_read, METH_VARARGS, _io_BytesIO_read__doc__},
|
||||
{"read", (PyCFunction)_io_BytesIO_read, METH_FASTCALL, _io_BytesIO_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_read_impl(bytesio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_read(bytesio *self, PyObject *args)
|
||||
_io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "read",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "read",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_BytesIO_read_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -204,22 +208,26 @@ PyDoc_STRVAR(_io_BytesIO_readline__doc__,
|
|||
"Return an empty bytes object at EOF.");
|
||||
|
||||
#define _IO_BYTESIO_READLINE_METHODDEF \
|
||||
{"readline", (PyCFunction)_io_BytesIO_readline, METH_VARARGS, _io_BytesIO_readline__doc__},
|
||||
{"readline", (PyCFunction)_io_BytesIO_readline, METH_FASTCALL, _io_BytesIO_readline__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_readline_impl(bytesio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_readline(bytesio *self, PyObject *args)
|
||||
_io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "readline",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "readline",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_BytesIO_readline_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -237,22 +245,26 @@ PyDoc_STRVAR(_io_BytesIO_readlines__doc__,
|
|||
"total number of bytes in the lines returned.");
|
||||
|
||||
#define _IO_BYTESIO_READLINES_METHODDEF \
|
||||
{"readlines", (PyCFunction)_io_BytesIO_readlines, METH_VARARGS, _io_BytesIO_readlines__doc__},
|
||||
{"readlines", (PyCFunction)_io_BytesIO_readlines, METH_FASTCALL, _io_BytesIO_readlines__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_readlines(bytesio *self, PyObject *args)
|
||||
_io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "readlines",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "readlines",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_BytesIO_readlines_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -304,22 +316,26 @@ PyDoc_STRVAR(_io_BytesIO_truncate__doc__,
|
|||
"The current file position is unchanged. Returns the new size.");
|
||||
|
||||
#define _IO_BYTESIO_TRUNCATE_METHODDEF \
|
||||
{"truncate", (PyCFunction)_io_BytesIO_truncate, METH_VARARGS, _io_BytesIO_truncate__doc__},
|
||||
{"truncate", (PyCFunction)_io_BytesIO_truncate, METH_FASTCALL, _io_BytesIO_truncate__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_truncate_impl(bytesio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_truncate(bytesio *self, PyObject *args)
|
||||
_io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "truncate",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_BytesIO_truncate_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -339,22 +355,26 @@ PyDoc_STRVAR(_io_BytesIO_seek__doc__,
|
|||
"Returns the new absolute position.");
|
||||
|
||||
#define _IO_BYTESIO_SEEK_METHODDEF \
|
||||
{"seek", (PyCFunction)_io_BytesIO_seek, METH_VARARGS, _io_BytesIO_seek__doc__},
|
||||
{"seek", (PyCFunction)_io_BytesIO_seek, METH_FASTCALL, _io_BytesIO_seek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
|
||||
|
||||
static PyObject *
|
||||
_io_BytesIO_seek(bytesio *self, PyObject *args)
|
||||
_io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t pos;
|
||||
int whence = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "n|i:seek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "n|i:seek",
|
||||
&pos, &whence)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_BytesIO_seek_impl(self, pos, whence);
|
||||
|
||||
exit:
|
||||
|
@ -429,4 +449,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=6382e8eb578eea64 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=08139186b009ec47 input=a9049054013a1b77]*/
|
||||
|
|
39
third_party/python/Modules/_io/clinic/fileio.inc
vendored
39
third_party/python/Modules/_io/clinic/fileio.inc
vendored
|
@ -15,6 +15,9 @@ PyDoc_STRVAR(_io_FileIO_close__doc__,
|
|||
#define _IO_FILEIO_CLOSE_METHODDEF \
|
||||
{"close", (PyCFunction)_io_FileIO_close, METH_NOARGS, _io_FileIO_close__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_close_impl(fileio *self);
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_close(fileio *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -39,6 +42,10 @@ PyDoc_STRVAR(_io_FileIO___init____doc__,
|
|||
"*opener* must return an open file descriptor (passing os.open as *opener*\n"
|
||||
"results in functionality similar to passing None).");
|
||||
|
||||
static int
|
||||
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
|
||||
int closefd, PyObject *opener);
|
||||
|
||||
static int
|
||||
_io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
|
@ -196,21 +203,25 @@ PyDoc_STRVAR(_io_FileIO_read__doc__,
|
|||
"Return an empty bytes object at EOF.");
|
||||
|
||||
#define _IO_FILEIO_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io_FileIO_read, METH_VARARGS, _io_FileIO_read__doc__},
|
||||
{"read", (PyCFunction)_io_FileIO_read, METH_FASTCALL, _io_FileIO_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_read(fileio *self, PyObject *args)
|
||||
_io_FileIO_read(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t size = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||
_PyIO_ConvertSsize_t, &size)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_FileIO_read_impl(self, size);
|
||||
|
||||
exit:
|
||||
|
@ -268,22 +279,26 @@ PyDoc_STRVAR(_io_FileIO_seek__doc__,
|
|||
"Note that not all file objects are seekable.");
|
||||
|
||||
#define _IO_FILEIO_SEEK_METHODDEF \
|
||||
{"seek", (PyCFunction)_io_FileIO_seek, METH_VARARGS, _io_FileIO_seek__doc__},
|
||||
{"seek", (PyCFunction)_io_FileIO_seek, METH_FASTCALL, _io_FileIO_seek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_seek(fileio *self, PyObject *args)
|
||||
_io_FileIO_seek(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *pos;
|
||||
int whence = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||
&pos, &whence)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_FileIO_seek_impl(self, pos, whence);
|
||||
|
||||
exit:
|
||||
|
@ -322,22 +337,26 @@ PyDoc_STRVAR(_io_FileIO_truncate__doc__,
|
|||
"The current file position is changed to the value of size.");
|
||||
|
||||
#define _IO_FILEIO_TRUNCATE_METHODDEF \
|
||||
{"truncate", (PyCFunction)_io_FileIO_truncate, METH_VARARGS, _io_FileIO_truncate__doc__},
|
||||
{"truncate", (PyCFunction)_io_FileIO_truncate, METH_FASTCALL, _io_FileIO_truncate__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
|
||||
|
||||
static PyObject *
|
||||
_io_FileIO_truncate(fileio *self, PyObject *args)
|
||||
_io_FileIO_truncate(fileio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *posobj = NULL;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "truncate",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||
0, 1,
|
||||
&posobj)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_FileIO_truncate_impl(self, posobj);
|
||||
|
||||
exit:
|
||||
|
@ -367,4 +386,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=51924bc0ee11d58e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=034d782a0daa82bd input=a9049054013a1b77]*/
|
||||
|
|
62
third_party/python/Modules/_io/clinic/iobase.inc
vendored
62
third_party/python/Modules/_io/clinic/iobase.inc
vendored
|
@ -12,6 +12,9 @@ PyDoc_STRVAR(_io__IOBase_tell__doc__,
|
|||
#define _IO__IOBASE_TELL_METHODDEF \
|
||||
{"tell", (PyCFunction)_io__IOBase_tell, METH_NOARGS, _io__IOBase_tell__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_tell_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -29,6 +32,9 @@ PyDoc_STRVAR(_io__IOBase_flush__doc__,
|
|||
#define _IO__IOBASE_FLUSH_METHODDEF \
|
||||
{"flush", (PyCFunction)_io__IOBase_flush, METH_NOARGS, _io__IOBase_flush__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_flush_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -46,6 +52,9 @@ PyDoc_STRVAR(_io__IOBase_close__doc__,
|
|||
#define _IO__IOBASE_CLOSE_METHODDEF \
|
||||
{"close", (PyCFunction)_io__IOBase_close, METH_NOARGS, _io__IOBase_close__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_close_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_close(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -64,6 +73,9 @@ PyDoc_STRVAR(_io__IOBase_seekable__doc__,
|
|||
#define _IO__IOBASE_SEEKABLE_METHODDEF \
|
||||
{"seekable", (PyCFunction)_io__IOBase_seekable, METH_NOARGS, _io__IOBase_seekable__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_seekable_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -81,6 +93,9 @@ PyDoc_STRVAR(_io__IOBase_readable__doc__,
|
|||
#define _IO__IOBASE_READABLE_METHODDEF \
|
||||
{"readable", (PyCFunction)_io__IOBase_readable, METH_NOARGS, _io__IOBase_readable__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_readable_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -98,6 +113,9 @@ PyDoc_STRVAR(_io__IOBase_writable__doc__,
|
|||
#define _IO__IOBASE_WRITABLE_METHODDEF \
|
||||
{"writable", (PyCFunction)_io__IOBase_writable, METH_NOARGS, _io__IOBase_writable__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_writable_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -115,6 +133,9 @@ PyDoc_STRVAR(_io__IOBase_fileno__doc__,
|
|||
#define _IO__IOBASE_FILENO_METHODDEF \
|
||||
{"fileno", (PyCFunction)_io__IOBase_fileno, METH_NOARGS, _io__IOBase_fileno__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_fileno_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -132,6 +153,9 @@ PyDoc_STRVAR(_io__IOBase_isatty__doc__,
|
|||
#define _IO__IOBASE_ISATTY_METHODDEF \
|
||||
{"isatty", (PyCFunction)_io__IOBase_isatty, METH_NOARGS, _io__IOBase_isatty__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_isatty_impl(PyObject *self);
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -151,18 +175,25 @@ PyDoc_STRVAR(_io__IOBase_readline__doc__,
|
|||
"terminator(s) recognized.");
|
||||
|
||||
#define _IO__IOBASE_READLINE_METHODDEF \
|
||||
{"readline", (PyCFunction)_io__IOBase_readline, METH_VARARGS, _io__IOBase_readline__doc__},
|
||||
{"readline", (PyCFunction)_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_readline(PyObject *self, PyObject *args)
|
||||
_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)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t limit = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:readline",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:readline",
|
||||
_PyIO_ConvertSsize_t, &limit)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__IOBase_readline_impl(self, limit);
|
||||
|
||||
exit:
|
||||
|
@ -180,18 +211,25 @@ PyDoc_STRVAR(_io__IOBase_readlines__doc__,
|
|||
"lines so far exceeds hint.");
|
||||
|
||||
#define _IO__IOBASE_READLINES_METHODDEF \
|
||||
{"readlines", (PyCFunction)_io__IOBase_readlines, METH_VARARGS, _io__IOBase_readlines__doc__},
|
||||
{"readlines", (PyCFunction)_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__IOBase_readlines(PyObject *self, PyObject *args)
|
||||
_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)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t hint = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:readlines",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:readlines",
|
||||
_PyIO_ConvertSsize_t, &hint)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__IOBase_readlines_impl(self, hint);
|
||||
|
||||
exit:
|
||||
|
@ -212,21 +250,25 @@ PyDoc_STRVAR(_io__RawIOBase_read__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO__RAWIOBASE_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io__RawIOBase_read, METH_VARARGS, _io__RawIOBase_read__doc__},
|
||||
{"read", (PyCFunction)_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
|
||||
|
||||
static PyObject *
|
||||
_io__RawIOBase_read(PyObject *self, PyObject *args)
|
||||
_io__RawIOBase_read(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t n = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|n:read",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|n:read",
|
||||
&n)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__RawIOBase_read_impl(self, n);
|
||||
|
||||
exit:
|
||||
|
@ -250,4 +292,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _io__RawIOBase_readall_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=0f53fed928d8e02f input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=1bcece367fc7b0cd input=a9049054013a1b77]*/
|
||||
|
|
|
@ -12,6 +12,9 @@ PyDoc_STRVAR(_io_StringIO_getvalue__doc__,
|
|||
#define _IO_STRINGIO_GETVALUE_METHODDEF \
|
||||
{"getvalue", (PyCFunction)_io_StringIO_getvalue, METH_NOARGS, _io_StringIO_getvalue__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_getvalue_impl(stringio *self);
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_getvalue(stringio *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
|
@ -46,22 +49,26 @@ PyDoc_STRVAR(_io_StringIO_read__doc__,
|
|||
"is reached. Return an empty string at EOF.");
|
||||
|
||||
#define _IO_STRINGIO_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io_StringIO_read, METH_VARARGS, _io_StringIO_read__doc__},
|
||||
{"read", (PyCFunction)_io_StringIO_read, METH_FASTCALL, _io_StringIO_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_read_impl(stringio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_read(stringio *self, PyObject *args)
|
||||
_io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "read",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "read",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_StringIO_read_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -77,22 +84,26 @@ PyDoc_STRVAR(_io_StringIO_readline__doc__,
|
|||
"Returns an empty string if EOF is hit immediately.");
|
||||
|
||||
#define _IO_STRINGIO_READLINE_METHODDEF \
|
||||
{"readline", (PyCFunction)_io_StringIO_readline, METH_VARARGS, _io_StringIO_readline__doc__},
|
||||
{"readline", (PyCFunction)_io_StringIO_readline, METH_FASTCALL, _io_StringIO_readline__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_readline_impl(stringio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_readline(stringio *self, PyObject *args)
|
||||
_io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "readline",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "readline",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_StringIO_readline_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -110,22 +121,26 @@ PyDoc_STRVAR(_io_StringIO_truncate__doc__,
|
|||
"Returns the new absolute position.");
|
||||
|
||||
#define _IO_STRINGIO_TRUNCATE_METHODDEF \
|
||||
{"truncate", (PyCFunction)_io_StringIO_truncate, METH_VARARGS, _io_StringIO_truncate__doc__},
|
||||
{"truncate", (PyCFunction)_io_StringIO_truncate, METH_FASTCALL, _io_StringIO_truncate__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_truncate_impl(stringio *self, PyObject *arg);
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_truncate(stringio *self, PyObject *args)
|
||||
_io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *arg = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "truncate",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||
0, 1,
|
||||
&arg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_StringIO_truncate_impl(self, arg);
|
||||
|
||||
exit:
|
||||
|
@ -145,22 +160,26 @@ PyDoc_STRVAR(_io_StringIO_seek__doc__,
|
|||
"Returns the new absolute position.");
|
||||
|
||||
#define _IO_STRINGIO_SEEK_METHODDEF \
|
||||
{"seek", (PyCFunction)_io_StringIO_seek, METH_VARARGS, _io_StringIO_seek__doc__},
|
||||
{"seek", (PyCFunction)_io_StringIO_seek, METH_FASTCALL, _io_StringIO_seek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
|
||||
|
||||
static PyObject *
|
||||
_io_StringIO_seek(stringio *self, PyObject *args)
|
||||
_io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t pos;
|
||||
int whence = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "n|i:seek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "n|i:seek",
|
||||
&pos, &whence)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_StringIO_seek_impl(self, pos, whence);
|
||||
|
||||
exit:
|
||||
|
@ -287,4 +306,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _io_StringIO_seekable_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=5dd5c2a213e75405 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ce8018ec29def422 input=a9049054013a1b77]*/
|
||||
|
|
50
third_party/python/Modules/_io/clinic/textio.inc
vendored
50
third_party/python/Modules/_io/clinic/textio.inc
vendored
|
@ -1,9 +1,3 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
|
@ -68,7 +62,7 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject **args, Py
|
|||
PyObject *input;
|
||||
int final = 0;
|
||||
|
||||
if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
|
||||
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
||||
&input, &final)) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -232,21 +226,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_read__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO_TEXTIOWRAPPER_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io_TextIOWrapper_read, METH_VARARGS, _io_TextIOWrapper_read__doc__},
|
||||
{"read", (PyCFunction)_io_TextIOWrapper_read, METH_FASTCALL, _io_TextIOWrapper_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_read(textio *self, PyObject *args)
|
||||
_io_TextIOWrapper_read(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t n = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||
_PyIO_ConvertSsize_t, &n)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_TextIOWrapper_read_impl(self, n);
|
||||
|
||||
exit:
|
||||
|
@ -259,21 +257,25 @@ PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \
|
||||
{"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_VARARGS, _io_TextIOWrapper_readline__doc__},
|
||||
{"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_FASTCALL, _io_TextIOWrapper_readline__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_readline(textio *self, PyObject *args)
|
||||
_io_TextIOWrapper_readline(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t size = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|n:readline",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|n:readline",
|
||||
&size)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("readline", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_TextIOWrapper_readline_impl(self, size);
|
||||
|
||||
exit:
|
||||
|
@ -286,22 +288,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \
|
||||
{"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_VARARGS, _io_TextIOWrapper_seek__doc__},
|
||||
{"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_seek(textio *self, PyObject *args)
|
||||
_io_TextIOWrapper_seek(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *cookieObj;
|
||||
int whence = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|i:seek",
|
||||
if (!_PyArg_ParseStack(args, nargs, "O|i:seek",
|
||||
&cookieObj, &whence)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("seek", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
|
||||
|
||||
exit:
|
||||
|
@ -331,22 +337,26 @@ PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__,
|
|||
"\n");
|
||||
|
||||
#define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \
|
||||
{"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_VARARGS, _io_TextIOWrapper_truncate__doc__},
|
||||
{"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_FASTCALL, _io_TextIOWrapper_truncate__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
|
||||
|
||||
static PyObject *
|
||||
_io_TextIOWrapper_truncate(textio *self, PyObject *args)
|
||||
_io_TextIOWrapper_truncate(textio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *pos = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "truncate",
|
||||
if (!_PyArg_UnpackStack(args, nargs, "truncate",
|
||||
0, 1,
|
||||
&pos)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("truncate", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
|
||||
|
||||
exit:
|
||||
|
@ -471,4 +481,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _io_TextIOWrapper_close_impl(self);
|
||||
}
|
||||
/*[clinic end generated code: output=78ad14eba1667254 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=67eba50449900a96 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
|
||||
"close($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -26,10 +24,6 @@ _io__WindowsConsoleIO_close(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
return _io__WindowsConsoleIO_close_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
|
||||
"_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
|
||||
"--\n"
|
||||
|
@ -66,10 +60,6 @@ exit:
|
|||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
|
||||
"fileno($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -91,10 +81,6 @@ _io__WindowsConsoleIO_fileno(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
return _io__WindowsConsoleIO_fileno_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
|
||||
"readable($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -113,10 +99,6 @@ _io__WindowsConsoleIO_readable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
return _io__WindowsConsoleIO_readable_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
|
||||
"writable($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -135,10 +117,6 @@ _io__WindowsConsoleIO_writable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
return _io__WindowsConsoleIO_writable_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
|
||||
"readinto($self, buffer, /)\n"
|
||||
"--\n"
|
||||
|
@ -171,10 +149,6 @@ exit:
|
|||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
|
||||
"readall($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -195,10 +169,6 @@ _io__WindowsConsoleIO_readall(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
return _io__WindowsConsoleIO_readall_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
||||
"read($self, size=-1, /)\n"
|
||||
"--\n"
|
||||
|
@ -210,31 +180,31 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
|||
"Return an empty bytes object at EOF.");
|
||||
|
||||
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF \
|
||||
{"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_VARARGS, _io__WindowsConsoleIO_read__doc__},
|
||||
{"read", (PyCFunction)_io__WindowsConsoleIO_read, METH_FASTCALL, _io__WindowsConsoleIO_read__doc__},
|
||||
|
||||
static PyObject *
|
||||
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
|
||||
|
||||
static PyObject *
|
||||
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject *args)
|
||||
_io__WindowsConsoleIO_read(winconsoleio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_ssize_t size = -1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O&:read",
|
||||
if (!_PyArg_ParseStack(args, nargs, "|O&:read",
|
||||
_PyIO_ConvertSsize_t, &size)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!_PyArg_NoStackKeywords("read", kwnames)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = _io__WindowsConsoleIO_read_impl(self, size);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
|
||||
"write($self, b, /)\n"
|
||||
"--\n"
|
||||
|
@ -270,10 +240,6 @@ exit:
|
|||
return return_value;
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
|
||||
"isatty($self, /)\n"
|
||||
"--\n"
|
||||
|
@ -291,42 +257,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||
{
|
||||
return _io__WindowsConsoleIO_isatty_impl(self);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_READABLE_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READABLE_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_READINTO_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READINTO_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_READALL_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READALL_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_READ_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_READ_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_WRITE_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_WRITE_METHODDEF) */
|
||||
|
||||
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
||||
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
|
||||
/*[clinic end generated code: output=9eba916f8537fff7 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=b097ceeb54d6e15e input=a9049054013a1b77]*/
|
||||
|
|
|
@ -1179,5 +1179,3 @@ PyTypeObject PyWindowsConsoleIO_Type = {
|
|||
};
|
||||
|
||||
PyAPI_DATA(PyObject *) _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
|
||||
|
||||
#endif /* MS_WINDOWS */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue