aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/_io
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Modules/_io
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Modules/_io')
-rw-r--r--contrib/tools/python3/src/Modules/_io/_iomodule.c150
-rw-r--r--contrib/tools/python3/src/Modules/_io/_iomodule.h6
-rw-r--r--contrib/tools/python3/src/Modules/_io/bufferedio.c174
-rw-r--r--contrib/tools/python3/src/Modules/_io/bytesio.c154
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/_iomodule.c.h340
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/bufferedio.c.h466
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/bytesio.c.h190
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/fileio.c.h182
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/iobase.c.h94
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/stringio.c.h156
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/textio.c.h452
-rw-r--r--contrib/tools/python3/src/Modules/_io/clinic/winconsoleio.c.h134
-rw-r--r--contrib/tools/python3/src/Modules/_io/fileio.c68
-rw-r--r--contrib/tools/python3/src/Modules/_io/iobase.c74
-rw-r--r--contrib/tools/python3/src/Modules/_io/stringio.c24
-rw-r--r--contrib/tools/python3/src/Modules/_io/textio.c540
-rw-r--r--contrib/tools/python3/src/Modules/_io/winconsoleio.c20
17 files changed, 1612 insertions, 1612 deletions
diff --git a/contrib/tools/python3/src/Modules/_io/_iomodule.c b/contrib/tools/python3/src/Modules/_io/_iomodule.c
index d7cadacea1..cb60a90e4b 100644
--- a/contrib/tools/python3/src/Modules/_io/_iomodule.c
+++ b/contrib/tools/python3/src/Modules/_io/_iomodule.c
@@ -101,9 +101,9 @@ _io.open
file: object
mode: str = "r"
buffering: int = -1
- encoding: str(accept={str, NoneType}) = None
- errors: str(accept={str, NoneType}) = None
- newline: str(accept={str, NoneType}) = None
+ encoding: str(accept={str, NoneType}) = None
+ errors: str(accept={str, NoneType}) = None
+ newline: str(accept={str, NoneType}) = None
closefd: bool(accept={int}) = True
opener: object = None
@@ -231,7 +231,7 @@ 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)
-/*[clinic end generated code: output=aefafc4ce2b46dc0 input=7295902222e6b311]*/
+/*[clinic end generated code: output=aefafc4ce2b46dc0 input=7295902222e6b311]*/
{
unsigned i;
@@ -240,7 +240,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
char rawmode[6], *m;
int line_buffering, is_number;
- long isatty = 0;
+ long isatty = 0;
PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL, *path_or_fd = NULL;
@@ -323,7 +323,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
if (universal) {
if (creating || writing || appending || updating) {
PyErr_SetString(PyExc_ValueError,
- "mode U cannot be combined with 'x', 'w', 'a', or '+'");
+ "mode U cannot be combined with 'x', 'w', 'a', or '+'");
goto error;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
@@ -362,29 +362,29 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
goto error;
}
- if (binary && buffering == 1) {
- if (PyErr_WarnEx(PyExc_RuntimeWarning,
- "line buffering (buffering=1) isn't supported in "
- "binary mode, the default buffer size will be used",
- 1) < 0) {
- goto error;
- }
- }
-
+ if (binary && buffering == 1) {
+ if (PyErr_WarnEx(PyExc_RuntimeWarning,
+ "line buffering (buffering=1) isn't supported in "
+ "binary mode, the default buffer size will be used",
+ 1) < 0) {
+ goto error;
+ }
+ }
+
/* Create the Raw file stream */
{
PyObject *RawIO_class = (PyObject *)&PyFileIO_Type;
#ifdef MS_WINDOWS
- const PyConfig *config = _Py_GetConfig();
- if (!config->legacy_windows_stdio && _PyIO_get_console_type(path_or_fd) != '\0') {
+ const PyConfig *config = _Py_GetConfig();
+ if (!config->legacy_windows_stdio && _PyIO_get_console_type(path_or_fd) != '\0') {
RawIO_class = (PyObject *)&PyWindowsConsoleIO_Type;
encoding = "utf-8";
}
#endif
- raw = PyObject_CallFunction(RawIO_class, "OsOO",
- path_or_fd, rawmode,
- closefd ? Py_True : Py_False,
- opener);
+ raw = PyObject_CallFunction(RawIO_class, "OsOO",
+ path_or_fd, rawmode,
+ closefd ? Py_True : Py_False,
+ opener);
}
if (raw == NULL)
@@ -399,8 +399,8 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
goto error;
/* buffering */
- if (buffering < 0) {
- PyObject *res = _PyObject_CallMethodIdNoArgs(raw, &PyId_isatty);
+ if (buffering < 0) {
+ PyObject *res = _PyObject_CallMethodIdNoArgs(raw, &PyId_isatty);
if (res == NULL)
goto error;
isatty = PyLong_AsLong(res);
@@ -409,7 +409,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
goto error;
}
- if (buffering == 1 || isatty) {
+ if (buffering == 1 || isatty) {
buffering = -1;
line_buffering = 1;
}
@@ -476,10 +476,10 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
/* wraps into a TextIOWrapper */
wrapper = PyObject_CallFunction((PyObject *)&PyTextIOWrapper_Type,
- "OsssO",
+ "OsssO",
buffer,
encoding, errors, newline,
- line_buffering ? Py_True : Py_False);
+ line_buffering ? Py_True : Py_False);
if (wrapper == NULL)
goto error;
result = wrapper;
@@ -494,7 +494,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
if (result != NULL) {
PyObject *exc, *val, *tb, *close_result;
PyErr_Fetch(&exc, &val, &tb);
- close_result = _PyObject_CallMethodIdNoArgs(result, &PyId_close);
+ close_result = _PyObject_CallMethodIdNoArgs(result, &PyId_close);
_PyErr_ChainExceptions(exc, val, tb);
Py_XDECREF(close_result);
Py_DECREF(result);
@@ -503,25 +503,25 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
Py_XDECREF(modeobj);
return NULL;
}
-
-/*[clinic input]
-_io.open_code
-
- path : unicode
-
-Opens the provided file with the intent to import the contents.
-
-This may perform extra validation beyond open(), but is otherwise interchangeable
-with calling open(path, 'rb').
-
-[clinic start generated code]*/
-
-static PyObject *
-_io_open_code_impl(PyObject *module, PyObject *path)
-/*[clinic end generated code: output=2fe4ecbd6f3d6844 input=f5c18e23f4b2ed9f]*/
-{
- return PyFile_OpenCodeObject(path);
-}
+
+/*[clinic input]
+_io.open_code
+
+ path : unicode
+
+Opens the provided file with the intent to import the contents.
+
+This may perform extra validation beyond open(), but is otherwise interchangeable
+with calling open(path, 'rb').
+
+[clinic start generated code]*/
+
+static PyObject *
+_io_open_code_impl(PyObject *module, PyObject *path)
+/*[clinic end generated code: output=2fe4ecbd6f3d6844 input=f5c18e23f4b2ed9f]*/
+{
+ return PyFile_OpenCodeObject(path);
+}
/*
* Private helpers for the io module.
@@ -563,7 +563,7 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
/* Otherwise replace the error with caller's error object. */
PyErr_Format(err,
"cannot fit '%.200s' into an offset-sized integer",
- Py_TYPE(item)->tp_name);
+ Py_TYPE(item)->tp_name);
}
finish:
@@ -571,20 +571,20 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
return result;
}
-static inline _PyIO_State*
-get_io_state(PyObject *module)
-{
- void *state = PyModule_GetState(module);
- assert(state != NULL);
- return (_PyIO_State *)state;
-}
+static inline _PyIO_State*
+get_io_state(PyObject *module)
+{
+ void *state = PyModule_GetState(module);
+ assert(state != NULL);
+ return (_PyIO_State *)state;
+}
_PyIO_State *
_PyIO_get_module_state(void)
{
PyObject *mod = PyState_FindModule(&_PyIO_Module);
_PyIO_State *state;
- if (mod == NULL || (state = get_io_state(mod)) == NULL) {
+ if (mod == NULL || (state = get_io_state(mod)) == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"could not find io module state "
"(interpreter shutdown?)");
@@ -620,7 +620,7 @@ _PyIO_get_locale_module(_PyIO_State *state)
static int
iomodule_traverse(PyObject *mod, visitproc visit, void *arg) {
- _PyIO_State *state = get_io_state(mod);
+ _PyIO_State *state = get_io_state(mod);
if (!state->initialized)
return 0;
if (state->locale_module != NULL) {
@@ -633,7 +633,7 @@ iomodule_traverse(PyObject *mod, visitproc visit, void *arg) {
static int
iomodule_clear(PyObject *mod) {
- _PyIO_State *state = get_io_state(mod);
+ _PyIO_State *state = get_io_state(mod);
if (!state->initialized)
return 0;
if (state->locale_module != NULL)
@@ -656,7 +656,7 @@ iomodule_free(PyObject *mod) {
static PyMethodDef module_methods[] = {
_IO_OPEN_METHODDEF
- _IO_OPEN_CODE_METHODDEF
+ _IO_OPEN_CODE_METHODDEF
{NULL, NULL}
};
@@ -679,11 +679,11 @@ PyInit__io(void)
_PyIO_State *state = NULL;
if (m == NULL)
return NULL;
- state = get_io_state(m);
+ state = get_io_state(m);
state->initialized = 0;
-#define ADD_TYPE(type) \
- if (PyModule_AddType(m, type) < 0) { \
+#define ADD_TYPE(type) \
+ if (PyModule_AddType(m, type) < 0) { \
goto fail; \
}
@@ -711,54 +711,54 @@ PyInit__io(void)
/* Concrete base types of the IO ABCs.
(the ABCs themselves are declared through inheritance in io.py)
*/
- ADD_TYPE(&PyIOBase_Type);
- ADD_TYPE(&PyRawIOBase_Type);
- ADD_TYPE(&PyBufferedIOBase_Type);
- ADD_TYPE(&PyTextIOBase_Type);
+ ADD_TYPE(&PyIOBase_Type);
+ ADD_TYPE(&PyRawIOBase_Type);
+ ADD_TYPE(&PyBufferedIOBase_Type);
+ ADD_TYPE(&PyTextIOBase_Type);
/* Implementation of concrete IO objects. */
/* FileIO */
PyFileIO_Type.tp_base = &PyRawIOBase_Type;
- ADD_TYPE(&PyFileIO_Type);
+ ADD_TYPE(&PyFileIO_Type);
/* BytesIO */
PyBytesIO_Type.tp_base = &PyBufferedIOBase_Type;
- ADD_TYPE(&PyBytesIO_Type);
+ ADD_TYPE(&PyBytesIO_Type);
if (PyType_Ready(&_PyBytesIOBuffer_Type) < 0)
goto fail;
/* StringIO */
PyStringIO_Type.tp_base = &PyTextIOBase_Type;
- ADD_TYPE(&PyStringIO_Type);
+ ADD_TYPE(&PyStringIO_Type);
#ifdef MS_WINDOWS
/* WindowsConsoleIO */
PyWindowsConsoleIO_Type.tp_base = &PyRawIOBase_Type;
- ADD_TYPE(&PyWindowsConsoleIO_Type);
+ ADD_TYPE(&PyWindowsConsoleIO_Type);
#endif
/* BufferedReader */
PyBufferedReader_Type.tp_base = &PyBufferedIOBase_Type;
- ADD_TYPE(&PyBufferedReader_Type);
+ ADD_TYPE(&PyBufferedReader_Type);
/* BufferedWriter */
PyBufferedWriter_Type.tp_base = &PyBufferedIOBase_Type;
- ADD_TYPE(&PyBufferedWriter_Type);
+ ADD_TYPE(&PyBufferedWriter_Type);
/* BufferedRWPair */
PyBufferedRWPair_Type.tp_base = &PyBufferedIOBase_Type;
- ADD_TYPE(&PyBufferedRWPair_Type);
+ ADD_TYPE(&PyBufferedRWPair_Type);
/* BufferedRandom */
PyBufferedRandom_Type.tp_base = &PyBufferedIOBase_Type;
- ADD_TYPE(&PyBufferedRandom_Type);
+ ADD_TYPE(&PyBufferedRandom_Type);
/* TextIOWrapper */
PyTextIOWrapper_Type.tp_base = &PyTextIOBase_Type;
- ADD_TYPE(&PyTextIOWrapper_Type);
+ ADD_TYPE(&PyTextIOWrapper_Type);
/* IncrementalNewlineDecoder */
- ADD_TYPE(&PyIncrementalNewlineDecoder_Type);
+ ADD_TYPE(&PyIncrementalNewlineDecoder_Type);
/* Interned strings */
#define ADD_INTERNED(name) \
diff --git a/contrib/tools/python3/src/Modules/_io/_iomodule.h b/contrib/tools/python3/src/Modules/_io/_iomodule.h
index a8f3951e57..4ecd36c7ed 100644
--- a/contrib/tools/python3/src/Modules/_io/_iomodule.h
+++ b/contrib/tools/python3/src/Modules/_io/_iomodule.h
@@ -2,8 +2,8 @@
* Declarations shared between the different parts of the io module
*/
-#include "exports.h"
-
+#include "exports.h"
+
/* ABCs */
extern PyTypeObject PyIOBase_Type;
extern PyTypeObject PyRawIOBase_Type;
@@ -185,4 +185,4 @@ extern PyObject *_PyIO_str_write;
extern PyObject *_PyIO_empty_str;
extern PyObject *_PyIO_empty_bytes;
-extern Py_EXPORTED_SYMBOL PyTypeObject _PyBytesIOBuffer_Type;
+extern Py_EXPORTED_SYMBOL PyTypeObject _PyBytesIOBuffer_Type;
diff --git a/contrib/tools/python3/src/Modules/_io/bufferedio.c b/contrib/tools/python3/src/Modules/_io/bufferedio.c
index b0fe9e4589..b6773b631c 100644
--- a/contrib/tools/python3/src/Modules/_io/bufferedio.c
+++ b/contrib/tools/python3/src/Modules/_io/bufferedio.c
@@ -9,8 +9,8 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_object.h"
-#include "structmember.h" // PyMemberDef
+#include "pycore_object.h"
+#include "structmember.h" // PyMemberDef
#include "_iomodule.h"
/*[clinic input]
@@ -290,11 +290,11 @@ _enter_buffered_busy(buffered *self)
}
Py_END_ALLOW_THREADS
if (relax_locking && st != PY_LOCK_ACQUIRED) {
- PyObject *ascii = PyObject_ASCII((PyObject*)self);
- _Py_FatalErrorFormat(__func__,
- "could not acquire lock for %s at interpreter "
+ PyObject *ascii = PyObject_ASCII((PyObject*)self);
+ _Py_FatalErrorFormat(__func__,
+ "could not acquire lock for %s at interpreter "
"shutdown, possibly due to daemon threads",
- ascii ? PyUnicode_AsUTF8(ascii) : "<ascii(self) failed>");
+ ascii ? PyUnicode_AsUTF8(ascii) : "<ascii(self) failed>");
}
return 1;
}
@@ -341,10 +341,10 @@ _enter_buffered_busy(buffered *self)
: buffered_closed(self)))
#define CHECK_CLOSED(self, error_msg) \
- if (IS_CLOSED(self) & (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
+ if (IS_CLOSED(self) & (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
PyErr_SetString(PyExc_ValueError, error_msg); \
return NULL; \
- } \
+ } \
#define VALID_READ_BUFFER(self) \
(self->readable && self->read_end != -1)
@@ -400,7 +400,7 @@ buffered_dealloc(buffered *self)
}
static PyObject *
-buffered_sizeof(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_sizeof(buffered *self, PyObject *Py_UNUSED(ignored))
{
Py_ssize_t res;
@@ -435,8 +435,8 @@ buffered_dealloc_warn(buffered *self, PyObject *source)
{
if (self->ok && self->raw) {
PyObject *r;
- r = _PyObject_CallMethodIdOneArg(self->raw, &PyId__dealloc_warn,
- source);
+ r = _PyObject_CallMethodIdOneArg(self->raw, &PyId__dealloc_warn,
+ source);
if (r)
Py_DECREF(r);
else
@@ -457,7 +457,7 @@ static PyObject *
buffered_simple_flush(buffered *self, PyObject *args)
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_flush);
}
static int
@@ -509,7 +509,7 @@ buffered_close(buffered *self, PyObject *args)
}
/* flush() will most probably re-take the lock, so drop it first */
LEAVE_BUFFERED(self)
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (!ENTER_BUFFERED(self))
return NULL;
if (res == NULL)
@@ -517,7 +517,7 @@ buffered_close(buffered *self, PyObject *args)
else
Py_DECREF(res);
- res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close);
+ res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_close);
if (self->buffer) {
PyMem_Free(self->buffer);
@@ -529,9 +529,9 @@ buffered_close(buffered *self, PyObject *args)
Py_CLEAR(res);
}
- self->read_end = 0;
- self->pos = 0;
-
+ self->read_end = 0;
+ self->pos = 0;
+
end:
LEAVE_BUFFERED(self)
return res;
@@ -540,11 +540,11 @@ end:
/* detach */
static PyObject *
-buffered_detach(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_detach(buffered *self, PyObject *Py_UNUSED(ignored))
{
PyObject *raw, *res;
CHECK_INITIALIZED(self)
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL)
return NULL;
Py_DECREF(res);
@@ -558,24 +558,24 @@ buffered_detach(buffered *self, PyObject *Py_UNUSED(ignored))
/* Inquiries */
static PyObject *
-buffered_seekable(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_seekable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_seekable);
}
static PyObject *
-buffered_readable(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_readable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_readable);
}
static PyObject *
-buffered_writable(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_writable(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_writable);
}
static PyObject *
@@ -595,17 +595,17 @@ buffered_mode_get(buffered *self, void *context)
/* Lower-level APIs */
static PyObject *
-buffered_fileno(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_fileno(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_fileno);
}
static PyObject *
-buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_isatty(buffered *self, PyObject *Py_UNUSED(ignored))
{
CHECK_INITIALIZED(self)
- return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty);
+ return PyObject_CallMethodNoArgs(self->raw, _PyIO_str_isatty);
}
/* Forward decls */
@@ -669,7 +669,7 @@ _buffered_raw_tell(buffered *self)
{
Py_off_t n;
PyObject *res;
- res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell);
+ res = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_tell);
if (res == NULL)
return -1;
n = PyNumber_AsOff_t(res, PyExc_ValueError);
@@ -964,7 +964,7 @@ _buffered_readinto_generic(buffered *self, Py_buffer *buffer, char readinto1)
PyObject *res = NULL;
CHECK_INITIALIZED(self)
- CHECK_CLOSED(self, "readinto of closed file")
+ CHECK_CLOSED(self, "readinto of closed file")
n = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t);
if (n > 0) {
@@ -1193,7 +1193,7 @@ _io__Buffered_readline_impl(buffered *self, Py_ssize_t size)
static PyObject *
-buffered_tell(buffered *self, PyObject *Py_UNUSED(ignored))
+buffered_tell(buffered *self, PyObject *Py_UNUSED(ignored))
{
Py_off_t pos;
@@ -1314,20 +1314,20 @@ _io__Buffered_truncate_impl(buffered *self, PyObject *pos)
PyObject *res = NULL;
CHECK_INITIALIZED(self)
- CHECK_CLOSED(self, "truncate of closed file")
- if (!self->writable) {
- return bufferediobase_unsupported("truncate");
- }
+ CHECK_CLOSED(self, "truncate of closed file")
+ if (!self->writable) {
+ return bufferediobase_unsupported("truncate");
+ }
if (!ENTER_BUFFERED(self))
return NULL;
- res = buffered_flush_and_rewind_unlocked(self);
- if (res == NULL) {
- goto end;
+ res = buffered_flush_and_rewind_unlocked(self);
+ if (res == NULL) {
+ goto end;
}
- Py_CLEAR(res);
-
- res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos);
+ Py_CLEAR(res);
+
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_truncate, pos);
if (res == NULL)
goto end;
/* Reset cached position */
@@ -1354,8 +1354,8 @@ buffered_iternext(buffered *self)
line = _buffered_readline(self, -1);
}
else {
- line = PyObject_CallMethodNoArgs((PyObject *)self,
- _PyIO_str_readline);
+ line = PyObject_CallMethodNoArgs((PyObject *)self,
+ _PyIO_str_readline);
if (line && !PyBytes_Check(line)) {
PyErr_Format(PyExc_OSError,
"readline() should have returned a bytes object, "
@@ -1382,13 +1382,13 @@ buffered_repr(buffered *self)
{
PyObject *nameobj, *res;
- if (_PyObject_LookupAttrId((PyObject *) self, &PyId_name, &nameobj) < 0) {
- if (!PyErr_ExceptionMatches(PyExc_ValueError)) {
- return NULL;
- }
- /* Ignore ValueError raised if the underlying stream was detached */
- PyErr_Clear();
- }
+ if (_PyObject_LookupAttrId((PyObject *) self, &PyId_name, &nameobj) < 0) {
+ if (!PyErr_ExceptionMatches(PyExc_ValueError)) {
+ return NULL;
+ }
+ /* Ignore ValueError raised if the underlying stream was detached */
+ PyErr_Clear();
+ }
if (nameobj == NULL) {
res = PyUnicode_FromFormat("<%s>", Py_TYPE(self)->tp_name);
}
@@ -1448,8 +1448,8 @@ _io_BufferedReader___init___impl(buffered *self, PyObject *raw,
return -1;
_bufferedreader_reset_buf(self);
- self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedReader_Type) &&
- Py_IS_TYPE(raw, &PyFileIO_Type));
+ self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedReader_Type) &&
+ Py_IS_TYPE(raw, &PyFileIO_Type));
self->ok = 1;
return 0;
@@ -1473,7 +1473,7 @@ _bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len)
raised (see issue #10956).
*/
do {
- res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj);
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_readinto, memobj);
} while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj);
if (res == NULL)
@@ -1572,7 +1572,7 @@ _bufferedreader_read_all(buffered *self)
}
/* Read until EOF or until read() would block. */
- data = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read);
+ data = PyObject_CallMethodNoArgs(self->raw, _PyIO_str_read);
if (data == NULL)
goto cleanup;
if (data != Py_None && !PyBytes_Check(data)) {
@@ -1794,8 +1794,8 @@ _io_BufferedWriter___init___impl(buffered *self, PyObject *raw,
_bufferedwriter_reset_buf(self);
self->pos = 0;
- self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedWriter_Type) &&
- Py_IS_TYPE(raw, &PyFileIO_Type));
+ self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedWriter_Type) &&
+ Py_IS_TYPE(raw, &PyFileIO_Type));
self->ok = 1;
return 0;
@@ -1821,7 +1821,7 @@ _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len)
*/
do {
errno = 0;
- res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj);
+ res = PyObject_CallMethodOneArg(self->raw, _PyIO_str_write, memobj);
errnum = errno;
} while (res == NULL && _PyIO_trap_eintr());
Py_DECREF(memobj);
@@ -2204,33 +2204,33 @@ bufferedrwpair_write(rwpair *self, PyObject *args)
}
static PyObject *
-bufferedrwpair_flush(rwpair *self, PyObject *Py_UNUSED(ignored))
+bufferedrwpair_flush(rwpair *self, PyObject *Py_UNUSED(ignored))
{
- return _forward_call(self->writer, &PyId_flush, NULL);
+ return _forward_call(self->writer, &PyId_flush, NULL);
}
static PyObject *
-bufferedrwpair_readable(rwpair *self, PyObject *Py_UNUSED(ignored))
+bufferedrwpair_readable(rwpair *self, PyObject *Py_UNUSED(ignored))
{
- return _forward_call(self->reader, &PyId_readable, NULL);
+ return _forward_call(self->reader, &PyId_readable, NULL);
}
static PyObject *
-bufferedrwpair_writable(rwpair *self, PyObject *Py_UNUSED(ignored))
+bufferedrwpair_writable(rwpair *self, PyObject *Py_UNUSED(ignored))
{
- return _forward_call(self->writer, &PyId_writable, NULL);
+ return _forward_call(self->writer, &PyId_writable, NULL);
}
static PyObject *
-bufferedrwpair_close(rwpair *self, PyObject *Py_UNUSED(ignored))
+bufferedrwpair_close(rwpair *self, PyObject *Py_UNUSED(ignored))
{
PyObject *exc = NULL, *val, *tb;
- PyObject *ret = _forward_call(self->writer, &PyId_close, NULL);
+ PyObject *ret = _forward_call(self->writer, &PyId_close, NULL);
if (ret == NULL)
PyErr_Fetch(&exc, &val, &tb);
else
Py_DECREF(ret);
- ret = _forward_call(self->reader, &PyId_close, NULL);
+ ret = _forward_call(self->reader, &PyId_close, NULL);
if (exc != NULL) {
_PyErr_ChainExceptions(exc, val, tb);
Py_CLEAR(ret);
@@ -2239,9 +2239,9 @@ bufferedrwpair_close(rwpair *self, PyObject *Py_UNUSED(ignored))
}
static PyObject *
-bufferedrwpair_isatty(rwpair *self, PyObject *Py_UNUSED(ignored))
+bufferedrwpair_isatty(rwpair *self, PyObject *Py_UNUSED(ignored))
{
- PyObject *ret = _forward_call(self->writer, &PyId_isatty, NULL);
+ PyObject *ret = _forward_call(self->writer, &PyId_isatty, NULL);
if (ret != Py_False) {
/* either True or exception */
@@ -2249,7 +2249,7 @@ bufferedrwpair_isatty(rwpair *self, PyObject *Py_UNUSED(ignored))
}
Py_DECREF(ret);
- return _forward_call(self->reader, &PyId_isatty, NULL);
+ return _forward_call(self->reader, &PyId_isatty, NULL);
}
static PyObject *
@@ -2308,8 +2308,8 @@ _io_BufferedRandom___init___impl(buffered *self, PyObject *raw,
_bufferedwriter_reset_buf(self);
self->pos = 0;
- self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedRandom_Type) &&
- Py_IS_TYPE(raw, &PyFileIO_Type));
+ self->fast_closed_checks = (Py_IS_TYPE(self, &PyBufferedRandom_Type) &&
+ Py_IS_TYPE(raw, &PyFileIO_Type));
self->ok = 1;
return 0;
@@ -2334,10 +2334,10 @@ PyTypeObject PyBufferedIOBase_Type = {
0, /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -2348,7 +2348,7 @@ PyTypeObject PyBufferedIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
bufferediobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -2424,10 +2424,10 @@ PyTypeObject PyBufferedReader_Type = {
sizeof(buffered), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)buffered_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
(reprfunc)buffered_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -2439,7 +2439,7 @@ PyTypeObject PyBufferedReader_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedReader___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
@@ -2510,10 +2510,10 @@ PyTypeObject PyBufferedWriter_Type = {
sizeof(buffered), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)buffered_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
(reprfunc)buffered_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -2525,7 +2525,7 @@ PyTypeObject PyBufferedWriter_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedWriter___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
@@ -2587,10 +2587,10 @@ PyTypeObject PyBufferedRWPair_Type = {
sizeof(rwpair), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)bufferedrwpair_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -2602,7 +2602,7 @@ PyTypeObject PyBufferedRWPair_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io_BufferedRWPair___init____doc__, /* tp_doc */
(traverseproc)bufferedrwpair_traverse, /* tp_traverse */
(inquiry)bufferedrwpair_clear, /* tp_clear */
@@ -2681,10 +2681,10 @@ PyTypeObject PyBufferedRandom_Type = {
sizeof(buffered), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)buffered_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
(reprfunc)buffered_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -2696,7 +2696,7 @@ PyTypeObject PyBufferedRandom_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_BufferedRandom___init____doc__, /* tp_doc */
(traverseproc)buffered_traverse, /* tp_traverse */
(inquiry)buffered_clear, /* tp_clear */
diff --git a/contrib/tools/python3/src/Modules/_io/bytesio.c b/contrib/tools/python3/src/Modules/_io/bytesio.c
index 2468f45f94..d17e18030d 100644
--- a/contrib/tools/python3/src/Modules/_io/bytesio.c
+++ b/contrib/tools/python3/src/Modules/_io/bytesio.c
@@ -1,6 +1,6 @@
#include "Python.h"
-#include "pycore_object.h"
-#include <stddef.h> // offsetof()
+#include "pycore_object.h"
+#include <stddef.h> // offsetof()
#include "_iomodule.h"
/*[clinic input]
@@ -31,34 +31,34 @@ typedef struct {
* exports > 0. Py_REFCNT(buf) == 1, any modifications are forbidden.
*/
-static int
-check_closed(bytesio *self)
-{
- if (self->buf == NULL) {
- PyErr_SetString(PyExc_ValueError, "I/O operation on closed file.");
- return 1;
- }
- return 0;
-}
-
-static int
-check_exports(bytesio *self)
-{
- if (self->exports > 0) {
- PyErr_SetString(PyExc_BufferError,
- "Existing exports of data: object cannot be re-sized");
- return 1;
- }
- return 0;
-}
-
+static int
+check_closed(bytesio *self)
+{
+ if (self->buf == NULL) {
+ PyErr_SetString(PyExc_ValueError, "I/O operation on closed file.");
+ return 1;
+ }
+ return 0;
+}
+
+static int
+check_exports(bytesio *self)
+{
+ if (self->exports > 0) {
+ PyErr_SetString(PyExc_BufferError,
+ "Existing exports of data: object cannot be re-sized");
+ return 1;
+ }
+ return 0;
+}
+
#define CHECK_CLOSED(self) \
- if (check_closed(self)) { \
+ if (check_closed(self)) { \
return NULL; \
}
#define CHECK_EXPORTS(self) \
- if (check_exports(self)) { \
+ if (check_exports(self)) { \
return NULL; \
}
@@ -173,41 +173,41 @@ resize_buffer(bytesio *self, size_t size)
}
/* Internal routine for writing a string of bytes to the buffer of a BytesIO
- object. Returns the number of bytes written, or -1 on error.
- Inlining is disabled because it's significantly decreases performance
- of writelines() in PGO build. */
-_Py_NO_INLINE static Py_ssize_t
-write_bytes(bytesio *self, PyObject *b)
+ object. Returns the number of bytes written, or -1 on error.
+ Inlining is disabled because it's significantly decreases performance
+ of writelines() in PGO build. */
+_Py_NO_INLINE static Py_ssize_t
+write_bytes(bytesio *self, PyObject *b)
{
- if (check_closed(self)) {
- return -1;
- }
- if (check_exports(self)) {
- return -1;
- }
-
- Py_buffer buf;
- if (PyObject_GetBuffer(b, &buf, PyBUF_CONTIG_RO) < 0) {
- return -1;
- }
- Py_ssize_t len = buf.len;
- if (len == 0) {
- goto done;
- }
-
+ if (check_closed(self)) {
+ return -1;
+ }
+ if (check_exports(self)) {
+ return -1;
+ }
+
+ Py_buffer buf;
+ if (PyObject_GetBuffer(b, &buf, PyBUF_CONTIG_RO) < 0) {
+ return -1;
+ }
+ Py_ssize_t len = buf.len;
+ if (len == 0) {
+ goto done;
+ }
+
assert(self->pos >= 0);
- size_t endpos = (size_t)self->pos + len;
+ size_t endpos = (size_t)self->pos + len;
if (endpos > (size_t)PyBytes_GET_SIZE(self->buf)) {
- if (resize_buffer(self, endpos) < 0) {
- len = -1;
- goto done;
- }
+ if (resize_buffer(self, endpos) < 0) {
+ len = -1;
+ goto done;
+ }
}
else if (SHARED_BUF(self)) {
- if (unshare_buffer(self, Py_MAX(endpos, (size_t)self->string_size)) < 0) {
- len = -1;
- goto done;
- }
+ if (unshare_buffer(self, Py_MAX(endpos, (size_t)self->string_size)) < 0) {
+ len = -1;
+ goto done;
+ }
}
if (self->pos > self->string_size) {
@@ -225,7 +225,7 @@ write_bytes(bytesio *self, PyObject *b)
/* Copy the data to the internal buffer, overwriting some of the existing
data if self->pos < self->string_size. */
- memcpy(PyBytes_AS_STRING(self->buf) + self->pos, buf.buf, len);
+ memcpy(PyBytes_AS_STRING(self->buf) + self->pos, buf.buf, len);
self->pos = endpos;
/* Set the new length of the internal string if it has changed. */
@@ -233,8 +233,8 @@ write_bytes(bytesio *self, PyObject *b)
self->string_size = endpos;
}
- done:
- PyBuffer_Release(&buf);
+ done:
+ PyBuffer_Release(&buf);
return len;
}
@@ -393,7 +393,7 @@ _io_BytesIO_tell_impl(bytesio *self)
static PyObject *
read_bytes(bytesio *self, Py_ssize_t size)
{
- const char *output;
+ const char *output;
assert(self->buf != NULL);
assert(size <= self->string_size);
@@ -502,7 +502,7 @@ _io_BytesIO_readlines_impl(bytesio *self, PyObject *arg)
{
Py_ssize_t maxsize, size, n;
PyObject *result, *line;
- const char *output;
+ const char *output;
CHECK_CLOSED(self);
@@ -706,7 +706,7 @@ static PyObject *
_io_BytesIO_write(bytesio *self, PyObject *b)
/*[clinic end generated code: output=53316d99800a0b95 input=f5ec7c8c64ed720a]*/
{
- Py_ssize_t n = write_bytes(self, b);
+ Py_ssize_t n = write_bytes(self, b);
return n >= 0 ? PyLong_FromSsize_t(n) : NULL;
}
@@ -735,9 +735,9 @@ _io_BytesIO_writelines(bytesio *self, PyObject *lines)
return NULL;
while ((item = PyIter_Next(it)) != NULL) {
- Py_ssize_t ret = write_bytes(self, item);
+ Py_ssize_t ret = write_bytes(self, item);
Py_DECREF(item);
- if (ret < 0) {
+ if (ret < 0) {
Py_DECREF(it);
return NULL;
}
@@ -782,7 +782,7 @@ _io_BytesIO_close_impl(bytesio *self)
*/
static PyObject *
-bytesio_getstate(bytesio *self, PyObject *Py_UNUSED(ignored))
+bytesio_getstate(bytesio *self, PyObject *Py_UNUSED(ignored))
{
PyObject *initvalue = _io_BytesIO_getvalue_impl(self);
PyObject *dict;
@@ -841,7 +841,7 @@ bytesio_setstate(bytesio *self, PyObject *state)
/* Set carefully the position value. Alternatively, we could use the seek
method instead of modifying self->pos directly to better protect the
- object internal state against erroneous (or malicious) inputs. */
+ object internal state against erroneous (or malicious) inputs. */
position_obj = PyTuple_GET_ITEM(state, 1);
if (!PyLong_Check(position_obj)) {
PyErr_Format(PyExc_TypeError,
@@ -966,13 +966,13 @@ bytesio_sizeof(bytesio *self, void *unused)
Py_ssize_t res;
res = _PyObject_SIZE(Py_TYPE(self));
- if (self->buf && !SHARED_BUF(self)) {
- Py_ssize_t s = _PySys_GetSizeOf(self->buf);
- if (s == -1) {
- return NULL;
- }
- res += s;
- }
+ if (self->buf && !SHARED_BUF(self)) {
+ Py_ssize_t s = _PySys_GetSizeOf(self->buf);
+ if (s == -1) {
+ return NULL;
+ }
+ res += s;
+ }
return PyLong_FromSsize_t(res);
}
@@ -1030,10 +1030,10 @@ PyTypeObject PyBytesIO_Type = {
sizeof(bytesio), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)bytesio_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -1124,16 +1124,16 @@ static PyBufferProcs bytesiobuf_as_buffer = {
(releasebufferproc) bytesiobuf_releasebuffer,
};
-Py_EXPORTED_SYMBOL PyTypeObject _PyBytesIOBuffer_Type = {
+Py_EXPORTED_SYMBOL PyTypeObject _PyBytesIOBuffer_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_io._BytesIOBuffer", /*tp_name*/
sizeof(bytesiobuf), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)bytesiobuf_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/_iomodule.c.h b/contrib/tools/python3/src/Modules/_io/clinic/_iomodule.c.h
index 1a9651d340..bd460e81a1 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/_iomodule.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/_iomodule.c.h
@@ -127,7 +127,7 @@ PyDoc_STRVAR(_io_open__doc__,
"opened in a binary mode.");
#define _IO_OPEN_METHODDEF \
- {"open", (PyCFunction)(void(*)(void))_io_open, METH_FASTCALL|METH_KEYWORDS, _io_open__doc__},
+ {"open", (PyCFunction)(void(*)(void))_io_open, METH_FASTCALL|METH_KEYWORDS, _io_open__doc__},
static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
@@ -139,9 +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 = {NULL, _keywords, "open", 0};
- PyObject *argsbuf[8];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+ 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;
@@ -151,176 +151,176 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
int closefd = 1;
PyObject *opener = Py_None;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 8, 0, argsbuf);
- if (!args) {
+ 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", "argument 'mode'", "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", "argument 'encoding'", "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", "argument 'errors'", "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", "argument 'newline'", "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:
+ file = args[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (args[1]) {
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("open", "argument 'mode'", "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", "argument 'encoding'", "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", "argument 'errors'", "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", "argument 'newline'", "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;
}
-
-PyDoc_STRVAR(_io_open_code__doc__,
-"open_code($module, /, path)\n"
-"--\n"
-"\n"
-"Opens the provided file with the intent to import the contents.\n"
-"\n"
-"This may perform extra validation beyond open(), but is otherwise interchangeable\n"
-"with calling open(path, \'rb\').");
-
-#define _IO_OPEN_CODE_METHODDEF \
- {"open_code", (PyCFunction)(void(*)(void))_io_open_code, METH_FASTCALL|METH_KEYWORDS, _io_open_code__doc__},
-
-static PyObject *
-_io_open_code_impl(PyObject *module, PyObject *path);
-
-static PyObject *
-_io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
-{
- PyObject *return_value = NULL;
- static const char * const _keywords[] = {"path", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "open_code", 0};
- PyObject *argsbuf[1];
- PyObject *path;
-
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
- if (!args) {
- goto exit;
- }
- if (!PyUnicode_Check(args[0])) {
- _PyArg_BadArgument("open_code", "argument 'path'", "str", args[0]);
- goto exit;
- }
- if (PyUnicode_READY(args[0]) == -1) {
- goto exit;
- }
- path = args[0];
- return_value = _io_open_code_impl(module, path);
-
-exit:
- return return_value;
-}
-/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(_io_open_code__doc__,
+"open_code($module, /, path)\n"
+"--\n"
+"\n"
+"Opens the provided file with the intent to import the contents.\n"
+"\n"
+"This may perform extra validation beyond open(), but is otherwise interchangeable\n"
+"with calling open(path, \'rb\').");
+
+#define _IO_OPEN_CODE_METHODDEF \
+ {"open_code", (PyCFunction)(void(*)(void))_io_open_code, METH_FASTCALL|METH_KEYWORDS, _io_open_code__doc__},
+
+static PyObject *
+_io_open_code_impl(PyObject *module, PyObject *path);
+
+static PyObject *
+_io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "open_code", 0};
+ PyObject *argsbuf[1];
+ PyObject *path;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("open_code", "argument 'path'", "str", args[0]);
+ goto exit;
+ }
+ if (PyUnicode_READY(args[0]) == -1) {
+ goto exit;
+ }
+ path = args[0];
+ return_value = _io_open_code_impl(module, path);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/bufferedio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/bufferedio.c.h
index 56d6332a25..4e3b6ab3d7 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/bufferedio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/bufferedio.c.h
@@ -19,15 +19,15 @@ _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__BufferedIOBase_readinto_impl(self, &buffer);
exit:
@@ -56,15 +56,15 @@ _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer);
exit:
@@ -103,7 +103,7 @@ PyDoc_STRVAR(_io__Buffered_peek__doc__,
"\n");
#define _IO__BUFFERED_PEEK_METHODDEF \
- {"peek", (PyCFunction)(void(*)(void))_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__},
+ {"peek", (PyCFunction)(void(*)(void))_io__Buffered_peek, METH_FASTCALL, _io__Buffered_peek__doc__},
static PyObject *
_io__Buffered_peek_impl(buffered *self, Py_ssize_t size);
@@ -114,30 +114,30 @@ _io__Buffered_peek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = 0;
- if (!_PyArg_CheckPositional("peek", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
+ if (!_PyArg_CheckPositional("peek", nargs, 0, 1)) {
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;
- }
- size = ival;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ 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;
+ }
+ size = ival;
+ }
+skip_optional:
return_value = _io__Buffered_peek_impl(self, size);
exit:
@@ -150,7 +150,7 @@ PyDoc_STRVAR(_io__Buffered_read__doc__,
"\n");
#define _IO__BUFFERED_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io__Buffered_read, METH_FASTCALL, _io__Buffered_read__doc__},
static PyObject *
_io__Buffered_read_impl(buffered *self, Py_ssize_t n);
@@ -161,16 +161,16 @@ _io__Buffered_read(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t n = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__Buffered_read_impl(self, n);
exit:
@@ -183,7 +183,7 @@ PyDoc_STRVAR(_io__Buffered_read1__doc__,
"\n");
#define _IO__BUFFERED_READ1_METHODDEF \
- {"read1", (PyCFunction)(void(*)(void))_io__Buffered_read1, METH_FASTCALL, _io__Buffered_read1__doc__},
+ {"read1", (PyCFunction)(void(*)(void))_io__Buffered_read1, METH_FASTCALL, _io__Buffered_read1__doc__},
static PyObject *
_io__Buffered_read1_impl(buffered *self, Py_ssize_t n);
@@ -194,30 +194,30 @@ _io__Buffered_read1(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t n = -1;
- if (!_PyArg_CheckPositional("read1", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("read1", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- 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;
- }
- n = ival;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ 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;
+ }
+ n = ival;
+ }
+skip_optional:
return_value = _io__Buffered_read1_impl(self, n);
exit:
@@ -241,15 +241,15 @@ _io__Buffered_readinto(buffered *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__Buffered_readinto_impl(self, &buffer);
exit:
@@ -278,15 +278,15 @@ _io__Buffered_readinto1(buffered *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto1", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto1", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__Buffered_readinto1_impl(self, &buffer);
exit:
@@ -304,7 +304,7 @@ PyDoc_STRVAR(_io__Buffered_readline__doc__,
"\n");
#define _IO__BUFFERED_READLINE_METHODDEF \
- {"readline", (PyCFunction)(void(*)(void))_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__},
+ {"readline", (PyCFunction)(void(*)(void))_io__Buffered_readline, METH_FASTCALL, _io__Buffered_readline__doc__},
static PyObject *
_io__Buffered_readline_impl(buffered *self, Py_ssize_t size);
@@ -315,16 +315,16 @@ _io__Buffered_readline(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__Buffered_readline_impl(self, size);
exit:
@@ -337,7 +337,7 @@ PyDoc_STRVAR(_io__Buffered_seek__doc__,
"\n");
#define _IO__BUFFERED_SEEK_METHODDEF \
- {"seek", (PyCFunction)(void(*)(void))_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__},
+ {"seek", (PyCFunction)(void(*)(void))_io__Buffered_seek, METH_FASTCALL, _io__Buffered_seek__doc__},
static PyObject *
_io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence);
@@ -349,23 +349,23 @@ _io__Buffered_seek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *targetobj;
int whence = 0;
- if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
- goto exit;
- }
- targetobj = args[0];
- if (nargs < 2) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
- whence = _PyLong_AsInt(args[1]);
- if (whence == -1 && PyErr_Occurred()) {
+ if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
-skip_optional:
+ targetobj = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[1]);
+ if (whence == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__Buffered_seek_impl(self, targetobj, whence);
exit:
@@ -378,7 +378,7 @@ PyDoc_STRVAR(_io__Buffered_truncate__doc__,
"\n");
#define _IO__BUFFERED_TRUNCATE_METHODDEF \
- {"truncate", (PyCFunction)(void(*)(void))_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__},
+ {"truncate", (PyCFunction)(void(*)(void))_io__Buffered_truncate, METH_FASTCALL, _io__Buffered_truncate__doc__},
static PyObject *
_io__Buffered_truncate_impl(buffered *self, PyObject *pos);
@@ -389,14 +389,14 @@ _io__Buffered_truncate(buffered *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *pos = Py_None;
- if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- pos = args[0];
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ pos = args[0];
+skip_optional:
return_value = _io__Buffered_truncate_impl(self, pos);
exit:
@@ -418,40 +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 = {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;
+ 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;
- 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" );
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
+ if (!fastargs) {
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:
+ 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:
@@ -477,40 +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 = {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;
+ 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;
- 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" );
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
+ if (!fastargs) {
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:
+ 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:
@@ -534,13 +534,13 @@ _io_BufferedWriter_write(buffered *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_SIMPLE) != 0) {
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io_BufferedWriter_write_impl(self, &buffer);
exit:
@@ -578,36 +578,36 @@ _io_BufferedRWPair___init__(PyObject *self, PyObject *args, PyObject *kwargs)
PyObject *writer;
Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE;
- if (Py_IS_TYPE(self, &PyBufferedRWPair_Type) &&
+ if (Py_IS_TYPE(self, &PyBufferedRWPair_Type) &&
!_PyArg_NoKeywords("BufferedRWPair", kwargs)) {
goto exit;
}
- if (!_PyArg_CheckPositional("BufferedRWPair", PyTuple_GET_SIZE(args), 2, 3)) {
- goto exit;
- }
- reader = PyTuple_GET_ITEM(args, 0);
- writer = PyTuple_GET_ITEM(args, 1);
- if (PyTuple_GET_SIZE(args) < 3) {
- goto skip_optional;
- }
- if (PyFloat_Check(PyTuple_GET_ITEM(args, 2))) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
+ if (!_PyArg_CheckPositional("BufferedRWPair", PyTuple_GET_SIZE(args), 2, 3)) {
goto exit;
}
- {
- Py_ssize_t ival = -1;
- PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
- if (iobj != NULL) {
- ival = PyLong_AsSsize_t(iobj);
- Py_DECREF(iobj);
- }
- if (ival == -1 && PyErr_Occurred()) {
- goto exit;
- }
- buffer_size = ival;
- }
-skip_optional:
+ reader = PyTuple_GET_ITEM(args, 0);
+ writer = PyTuple_GET_ITEM(args, 1);
+ if (PyTuple_GET_SIZE(args) < 3) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(PyTuple_GET_ITEM(args, 2))) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ {
+ Py_ssize_t ival = -1;
+ PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
+ if (iobj != NULL) {
+ ival = PyLong_AsSsize_t(iobj);
+ Py_DECREF(iobj);
+ }
+ if (ival == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ buffer_size = ival;
+ }
+skip_optional:
return_value = _io_BufferedRWPair___init___impl((rwpair *)self, reader, writer, buffer_size);
exit:
@@ -633,43 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
- if (!fastargs) {
+ 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:
+ 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=7d9ad40c95bdd808 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7d9ad40c95bdd808 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/bytesio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/bytesio.c.h
index 83cd490dc5..a0949a6ff9 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/bytesio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/bytesio.c.h
@@ -158,7 +158,7 @@ PyDoc_STRVAR(_io_BytesIO_read__doc__,
"Return an empty bytes object at EOF.");
#define _IO_BYTESIO_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io_BytesIO_read, METH_FASTCALL, _io_BytesIO_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io_BytesIO_read, METH_FASTCALL, _io_BytesIO_read__doc__},
static PyObject *
_io_BytesIO_read_impl(bytesio *self, Py_ssize_t size);
@@ -169,16 +169,16 @@ _io_BytesIO_read(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_BytesIO_read_impl(self, size);
exit:
@@ -195,7 +195,7 @@ PyDoc_STRVAR(_io_BytesIO_read1__doc__,
"Return an empty bytes object at EOF.");
#define _IO_BYTESIO_READ1_METHODDEF \
- {"read1", (PyCFunction)(void(*)(void))_io_BytesIO_read1, METH_FASTCALL, _io_BytesIO_read1__doc__},
+ {"read1", (PyCFunction)(void(*)(void))_io_BytesIO_read1, METH_FASTCALL, _io_BytesIO_read1__doc__},
static PyObject *
_io_BytesIO_read1_impl(bytesio *self, Py_ssize_t size);
@@ -206,16 +206,16 @@ _io_BytesIO_read1(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("read1", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ if (!_PyArg_CheckPositional("read1", nargs, 0, 1)) {
goto exit;
}
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_BytesIO_read1_impl(self, size);
exit:
@@ -233,7 +233,7 @@ PyDoc_STRVAR(_io_BytesIO_readline__doc__,
"Return an empty bytes object at EOF.");
#define _IO_BYTESIO_READLINE_METHODDEF \
- {"readline", (PyCFunction)(void(*)(void))_io_BytesIO_readline, METH_FASTCALL, _io_BytesIO_readline__doc__},
+ {"readline", (PyCFunction)(void(*)(void))_io_BytesIO_readline, METH_FASTCALL, _io_BytesIO_readline__doc__},
static PyObject *
_io_BytesIO_readline_impl(bytesio *self, Py_ssize_t size);
@@ -244,16 +244,16 @@ _io_BytesIO_readline(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_BytesIO_readline_impl(self, size);
exit:
@@ -271,7 +271,7 @@ PyDoc_STRVAR(_io_BytesIO_readlines__doc__,
"total number of bytes in the lines returned.");
#define _IO_BYTESIO_READLINES_METHODDEF \
- {"readlines", (PyCFunction)(void(*)(void))_io_BytesIO_readlines, METH_FASTCALL, _io_BytesIO_readlines__doc__},
+ {"readlines", (PyCFunction)(void(*)(void))_io_BytesIO_readlines, METH_FASTCALL, _io_BytesIO_readlines__doc__},
static PyObject *
_io_BytesIO_readlines_impl(bytesio *self, PyObject *arg);
@@ -282,14 +282,14 @@ _io_BytesIO_readlines(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
PyObject *arg = Py_None;
- if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- arg = args[0];
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ arg = args[0];
+skip_optional:
return_value = _io_BytesIO_readlines_impl(self, arg);
exit:
@@ -317,15 +317,15 @@ _io_BytesIO_readinto(bytesio *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io_BytesIO_readinto_impl(self, &buffer);
exit:
@@ -347,7 +347,7 @@ PyDoc_STRVAR(_io_BytesIO_truncate__doc__,
"The current file position is unchanged. Returns the new size.");
#define _IO_BYTESIO_TRUNCATE_METHODDEF \
- {"truncate", (PyCFunction)(void(*)(void))_io_BytesIO_truncate, METH_FASTCALL, _io_BytesIO_truncate__doc__},
+ {"truncate", (PyCFunction)(void(*)(void))_io_BytesIO_truncate, METH_FASTCALL, _io_BytesIO_truncate__doc__},
static PyObject *
_io_BytesIO_truncate_impl(bytesio *self, Py_ssize_t size);
@@ -358,16 +358,16 @@ _io_BytesIO_truncate(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = self->pos;
- if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_BytesIO_truncate_impl(self, size);
exit:
@@ -387,7 +387,7 @@ PyDoc_STRVAR(_io_BytesIO_seek__doc__,
"Returns the new absolute position.");
#define _IO_BYTESIO_SEEK_METHODDEF \
- {"seek", (PyCFunction)(void(*)(void))_io_BytesIO_seek, METH_FASTCALL, _io_BytesIO_seek__doc__},
+ {"seek", (PyCFunction)(void(*)(void))_io_BytesIO_seek, METH_FASTCALL, _io_BytesIO_seek__doc__},
static PyObject *
_io_BytesIO_seek_impl(bytesio *self, Py_ssize_t pos, int whence);
@@ -399,39 +399,39 @@ _io_BytesIO_seek(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
Py_ssize_t pos;
int whence = 0;
- if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
- 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;
- }
- pos = ival;
- }
- if (nargs < 2) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
+ if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
- whence = _PyLong_AsInt(args[1]);
- if (whence == -1 && PyErr_Occurred()) {
- goto exit;
- }
-skip_optional:
+ 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;
+ }
+ pos = ival;
+ }
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[1]);
+ if (whence == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_BytesIO_seek_impl(self, pos, whence);
exit:
@@ -494,25 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
- if (!fastargs) {
+ 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:
+ 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=4ec2506def9c8eb9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/fileio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/fileio.c.h
index 53e7067cf7..daf29446f7 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/fileio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/fileio.c.h
@@ -50,58 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 4, 0, argsbuf);
- if (!fastargs) {
+ 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", "argument 'mode'", "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:
+ nameobj = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[1]) {
+ if (!PyUnicode_Check(fastargs[1])) {
+ _PyArg_BadArgument("FileIO", "argument 'mode'", "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:
@@ -198,15 +198,15 @@ _io_FileIO_readinto(fileio *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io_FileIO_readinto_impl(self, &buffer);
exit:
@@ -250,7 +250,7 @@ PyDoc_STRVAR(_io_FileIO_read__doc__,
"Return an empty bytes object at EOF.");
#define _IO_FILEIO_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io_FileIO_read, METH_FASTCALL, _io_FileIO_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io_FileIO_read, METH_FASTCALL, _io_FileIO_read__doc__},
static PyObject *
_io_FileIO_read_impl(fileio *self, Py_ssize_t size);
@@ -261,16 +261,16 @@ _io_FileIO_read(fileio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_FileIO_read_impl(self, size);
exit:
@@ -299,13 +299,13 @@ _io_FileIO_write(fileio *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer b = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) {
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&b, 'C')) {
- _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) {
goto exit;
}
+ if (!PyBuffer_IsContiguous(&b, 'C')) {
+ _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io_FileIO_write_impl(self, &b);
exit:
@@ -332,7 +332,7 @@ PyDoc_STRVAR(_io_FileIO_seek__doc__,
"Note that not all file objects are seekable.");
#define _IO_FILEIO_SEEK_METHODDEF \
- {"seek", (PyCFunction)(void(*)(void))_io_FileIO_seek, METH_FASTCALL, _io_FileIO_seek__doc__},
+ {"seek", (PyCFunction)(void(*)(void))_io_FileIO_seek, METH_FASTCALL, _io_FileIO_seek__doc__},
static PyObject *
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
@@ -344,23 +344,23 @@ _io_FileIO_seek(fileio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *pos;
int whence = 0;
- if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
- goto exit;
- }
- pos = args[0];
- if (nargs < 2) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
- whence = _PyLong_AsInt(args[1]);
- if (whence == -1 && PyErr_Occurred()) {
+ if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
-skip_optional:
+ pos = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[1]);
+ if (whence == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_FileIO_seek_impl(self, pos, whence);
exit:
@@ -399,7 +399,7 @@ PyDoc_STRVAR(_io_FileIO_truncate__doc__,
"The current file position is changed to the value of size.");
#define _IO_FILEIO_TRUNCATE_METHODDEF \
- {"truncate", (PyCFunction)(void(*)(void))_io_FileIO_truncate, METH_FASTCALL, _io_FileIO_truncate__doc__},
+ {"truncate", (PyCFunction)(void(*)(void))_io_FileIO_truncate, METH_FASTCALL, _io_FileIO_truncate__doc__},
static PyObject *
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj);
@@ -408,16 +408,16 @@ static PyObject *
_io_FileIO_truncate(fileio *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- PyObject *posobj = Py_None;
+ PyObject *posobj = Py_None;
- if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- posobj = args[0];
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ posobj = args[0];
+skip_optional:
return_value = _io_FileIO_truncate_impl(self, posobj);
exit:
@@ -447,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=e7682d0a3264d284 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e7682d0a3264d284 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/iobase.c.h b/contrib/tools/python3/src/Modules/_io/clinic/iobase.c.h
index ddaff7b5d1..82ab4a7f27 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/iobase.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/iobase.c.h
@@ -174,7 +174,7 @@ PyDoc_STRVAR(_io__IOBase_readline__doc__,
"terminator(s) recognized.");
#define _IO__IOBASE_READLINE_METHODDEF \
- {"readline", (PyCFunction)(void(*)(void))_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__},
+ {"readline", (PyCFunction)(void(*)(void))_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__},
static PyObject *
_io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
@@ -185,16 +185,16 @@ _io__IOBase_readline(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t limit = -1;
- if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &limit)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &limit)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__IOBase_readline_impl(self, limit);
exit:
@@ -212,7 +212,7 @@ PyDoc_STRVAR(_io__IOBase_readlines__doc__,
"lines so far exceeds hint.");
#define _IO__IOBASE_READLINES_METHODDEF \
- {"readlines", (PyCFunction)(void(*)(void))_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__},
+ {"readlines", (PyCFunction)(void(*)(void))_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__},
static PyObject *
_io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
@@ -223,16 +223,16 @@ _io__IOBase_readlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t hint = -1;
- if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &hint)) {
+ if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
goto exit;
}
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &hint)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__IOBase_readlines_impl(self, hint);
exit:
@@ -242,11 +242,11 @@ exit:
PyDoc_STRVAR(_io__IOBase_writelines__doc__,
"writelines($self, lines, /)\n"
"--\n"
-"\n"
-"Write a list of lines to stream.\n"
-"\n"
-"Line separators are not added, so it is usual for each of the\n"
-"lines provided to have a line separator at the end.");
+"\n"
+"Write a list of lines to stream.\n"
+"\n"
+"Line separators are not added, so it is usual for each of the\n"
+"lines provided to have a line separator at the end.");
#define _IO__IOBASE_WRITELINES_METHODDEF \
{"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__},
@@ -257,7 +257,7 @@ PyDoc_STRVAR(_io__RawIOBase_read__doc__,
"\n");
#define _IO__RAWIOBASE_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__},
static PyObject *
_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
@@ -268,30 +268,30 @@ _io__RawIOBase_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t n = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
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;
- }
- n = ival;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ 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;
+ }
+ n = ival;
+ }
+skip_optional:
return_value = _io__RawIOBase_read_impl(self, n);
exit:
@@ -315,4 +315,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _io__RawIOBase_readall_impl(self);
}
-/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/stringio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/stringio.c.h
index 77a720c2a6..e1b1e6537a 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/stringio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/stringio.c.h
@@ -48,7 +48,7 @@ PyDoc_STRVAR(_io_StringIO_read__doc__,
"is reached. Return an empty string at EOF.");
#define _IO_STRINGIO_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io_StringIO_read, METH_FASTCALL, _io_StringIO_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io_StringIO_read, METH_FASTCALL, _io_StringIO_read__doc__},
static PyObject *
_io_StringIO_read_impl(stringio *self, Py_ssize_t size);
@@ -59,16 +59,16 @@ _io_StringIO_read(stringio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_StringIO_read_impl(self, size);
exit:
@@ -84,7 +84,7 @@ PyDoc_STRVAR(_io_StringIO_readline__doc__,
"Returns an empty string if EOF is hit immediately.");
#define _IO_STRINGIO_READLINE_METHODDEF \
- {"readline", (PyCFunction)(void(*)(void))_io_StringIO_readline, METH_FASTCALL, _io_StringIO_readline__doc__},
+ {"readline", (PyCFunction)(void(*)(void))_io_StringIO_readline, METH_FASTCALL, _io_StringIO_readline__doc__},
static PyObject *
_io_StringIO_readline_impl(stringio *self, Py_ssize_t size);
@@ -95,16 +95,16 @@ _io_StringIO_readline(stringio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_StringIO_readline_impl(self, size);
exit:
@@ -122,7 +122,7 @@ PyDoc_STRVAR(_io_StringIO_truncate__doc__,
"Returns the new absolute position.");
#define _IO_STRINGIO_TRUNCATE_METHODDEF \
- {"truncate", (PyCFunction)(void(*)(void))_io_StringIO_truncate, METH_FASTCALL, _io_StringIO_truncate__doc__},
+ {"truncate", (PyCFunction)(void(*)(void))_io_StringIO_truncate, METH_FASTCALL, _io_StringIO_truncate__doc__},
static PyObject *
_io_StringIO_truncate_impl(stringio *self, Py_ssize_t size);
@@ -133,16 +133,16 @@ _io_StringIO_truncate(stringio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t size = self->pos;
- if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_StringIO_truncate_impl(self, size);
exit:
@@ -162,7 +162,7 @@ PyDoc_STRVAR(_io_StringIO_seek__doc__,
"Returns the new absolute position.");
#define _IO_STRINGIO_SEEK_METHODDEF \
- {"seek", (PyCFunction)(void(*)(void))_io_StringIO_seek, METH_FASTCALL, _io_StringIO_seek__doc__},
+ {"seek", (PyCFunction)(void(*)(void))_io_StringIO_seek, METH_FASTCALL, _io_StringIO_seek__doc__},
static PyObject *
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence);
@@ -174,39 +174,39 @@ _io_StringIO_seek(stringio *self, PyObject *const *args, Py_ssize_t nargs)
Py_ssize_t pos;
int whence = 0;
- if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
+ if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
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;
- }
- pos = ival;
- }
- if (nargs < 2) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
- whence = _PyLong_AsInt(args[1]);
- if (whence == -1 && PyErr_Occurred()) {
- goto exit;
- }
-skip_optional:
+ 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;
+ }
+ pos = ival;
+ }
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[1]);
+ if (whence == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_StringIO_seek_impl(self, pos, whence);
exit:
@@ -266,29 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
- if (!fastargs) {
+ 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:
+ 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:
@@ -348,4 +348,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{
return _io_StringIO_seekable_impl(self);
}
-/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
index b8b507543e..53a8001449 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/textio.c.h
@@ -25,34 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 3, 0, argsbuf);
- if (!fastargs) {
+ 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:
+ 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:
@@ -65,7 +65,7 @@ PyDoc_STRVAR(_io_IncrementalNewlineDecoder_decode__doc__,
"\n");
#define _IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF \
- {"decode", (PyCFunction)(void(*)(void))_io_IncrementalNewlineDecoder_decode, METH_FASTCALL|METH_KEYWORDS, _io_IncrementalNewlineDecoder_decode__doc__},
+ {"decode", (PyCFunction)(void(*)(void))_io_IncrementalNewlineDecoder_decode, METH_FASTCALL|METH_KEYWORDS, _io_IncrementalNewlineDecoder_decode__doc__},
static PyObject *
_io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
@@ -76,30 +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 = {NULL, _keywords, "decode", 0};
- PyObject *argsbuf[2];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
+ 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;
- 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()) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
-skip_optional_pos:
+ 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:
@@ -193,11 +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 = {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;
+ 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;
@@ -205,90 +205,90 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
int line_buffering = 0;
int write_through = 0;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 6, 0, argsbuf);
- if (!fastargs) {
+ 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", "argument 'encoding'", "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", "argument 'newline'", "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:
+ 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", "argument 'encoding'", "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", "argument 'newline'", "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:
@@ -305,7 +305,7 @@ PyDoc_STRVAR(_io_TextIOWrapper_reconfigure__doc__,
"This also does an implicit stream flush.");
#define _IO_TEXTIOWRAPPER_RECONFIGURE_METHODDEF \
- {"reconfigure", (PyCFunction)(void(*)(void))_io_TextIOWrapper_reconfigure, METH_FASTCALL|METH_KEYWORDS, _io_TextIOWrapper_reconfigure__doc__},
+ {"reconfigure", (PyCFunction)(void(*)(void))_io_TextIOWrapper_reconfigure, METH_FASTCALL|METH_KEYWORDS, _io_TextIOWrapper_reconfigure__doc__},
static PyObject *
_io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
@@ -318,48 +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 = {NULL, _keywords, "reconfigure", 0};
- PyObject *argsbuf[5];
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 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;
- args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
- if (!args) {
+ 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:
+ 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:
@@ -400,14 +400,14 @@ _io_TextIOWrapper_write(textio *self, PyObject *arg)
PyObject *return_value = NULL;
PyObject *text;
- if (!PyUnicode_Check(arg)) {
- _PyArg_BadArgument("write", "argument", "str", arg);
- goto exit;
- }
- if (PyUnicode_READY(arg) == -1) {
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("write", "argument", "str", arg);
goto exit;
}
- text = arg;
+ if (PyUnicode_READY(arg) == -1) {
+ goto exit;
+ }
+ text = arg;
return_value = _io_TextIOWrapper_write_impl(self, text);
exit:
@@ -420,7 +420,7 @@ PyDoc_STRVAR(_io_TextIOWrapper_read__doc__,
"\n");
#define _IO_TEXTIOWRAPPER_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io_TextIOWrapper_read, METH_FASTCALL, _io_TextIOWrapper_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io_TextIOWrapper_read, METH_FASTCALL, _io_TextIOWrapper_read__doc__},
static PyObject *
_io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
@@ -431,16 +431,16 @@ _io_TextIOWrapper_read(textio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
Py_ssize_t n = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_TextIOWrapper_read_impl(self, n);
exit:
@@ -453,7 +453,7 @@ PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__,
"\n");
#define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \
- {"readline", (PyCFunction)(void(*)(void))_io_TextIOWrapper_readline, METH_FASTCALL, _io_TextIOWrapper_readline__doc__},
+ {"readline", (PyCFunction)(void(*)(void))_io_TextIOWrapper_readline, METH_FASTCALL, _io_TextIOWrapper_readline__doc__},
static PyObject *
_io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
@@ -464,30 +464,30 @@ _io_TextIOWrapper_readline(textio *self, PyObject *const *args, Py_ssize_t nargs
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- 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;
- }
- size = ival;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ 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;
+ }
+ size = ival;
+ }
+skip_optional:
return_value = _io_TextIOWrapper_readline_impl(self, size);
exit:
@@ -500,7 +500,7 @@ PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__,
"\n");
#define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \
- {"seek", (PyCFunction)(void(*)(void))_io_TextIOWrapper_seek, METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
+ {"seek", (PyCFunction)(void(*)(void))_io_TextIOWrapper_seek, METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
static PyObject *
_io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
@@ -512,23 +512,23 @@ _io_TextIOWrapper_seek(textio *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *cookieObj;
int whence = 0;
- if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
+ if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
- cookieObj = args[0];
- if (nargs < 2) {
- goto skip_optional;
- }
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
- whence = _PyLong_AsInt(args[1]);
- if (whence == -1 && PyErr_Occurred()) {
- goto exit;
- }
-skip_optional:
+ cookieObj = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[1]);
+ if (whence == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+skip_optional:
return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
exit:
@@ -558,7 +558,7 @@ PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__,
"\n");
#define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \
- {"truncate", (PyCFunction)(void(*)(void))_io_TextIOWrapper_truncate, METH_FASTCALL, _io_TextIOWrapper_truncate__doc__},
+ {"truncate", (PyCFunction)(void(*)(void))_io_TextIOWrapper_truncate, METH_FASTCALL, _io_TextIOWrapper_truncate__doc__},
static PyObject *
_io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
@@ -569,14 +569,14 @@ _io_TextIOWrapper_truncate(textio *self, PyObject *const *args, Py_ssize_t nargs
PyObject *return_value = NULL;
PyObject *pos = Py_None;
- if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- pos = args[0];
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ pos = args[0];
+skip_optional:
return_value = _io_TextIOWrapper_truncate_impl(self, pos);
exit:
@@ -701,4 +701,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
-/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/clinic/winconsoleio.c.h b/contrib/tools/python3/src/Modules/_io/clinic/winconsoleio.c.h
index 3e501a5853..f008678154 100644
--- a/contrib/tools/python3/src/Modules/_io/clinic/winconsoleio.c.h
+++ b/contrib/tools/python3/src/Modules/_io/clinic/winconsoleio.c.h
@@ -49,58 +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 = {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;
+ 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;
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 4, 0, argsbuf);
- if (!fastargs) {
+ 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", "argument 'mode'", "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:
+ nameobj = fastargs[0];
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (fastargs[1]) {
+ if (!PyUnicode_Check(fastargs[1])) {
+ _PyArg_BadArgument("_WindowsConsoleIO", "argument 'mode'", "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:
@@ -198,15 +198,15 @@ _io__WindowsConsoleIO_readinto(winconsoleio *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer buffer = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
- PyErr_Clear();
- _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&buffer, 'C')) {
- _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &buffer, PyBUF_WRITABLE) < 0) {
+ PyErr_Clear();
+ _PyArg_BadArgument("readinto", "argument", "read-write bytes-like object", arg);
goto exit;
}
+ if (!PyBuffer_IsContiguous(&buffer, 'C')) {
+ _PyArg_BadArgument("readinto", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__WindowsConsoleIO_readinto_impl(self, &buffer);
exit:
@@ -257,7 +257,7 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
"Return an empty bytes object at EOF.");
#define _IO__WINDOWSCONSOLEIO_READ_METHODDEF \
- {"read", (PyCFunction)(void(*)(void))_io__WindowsConsoleIO_read, METH_FASTCALL, _io__WindowsConsoleIO_read__doc__},
+ {"read", (PyCFunction)(void(*)(void))_io__WindowsConsoleIO_read, METH_FASTCALL, _io__WindowsConsoleIO_read__doc__},
static PyObject *
_io__WindowsConsoleIO_read_impl(winconsoleio *self, Py_ssize_t size);
@@ -268,16 +268,16 @@ _io__WindowsConsoleIO_read(winconsoleio *self, PyObject *const *args, Py_ssize_t
PyObject *return_value = NULL;
Py_ssize_t size = -1;
- if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
+ if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
goto exit;
}
- if (nargs < 1) {
- goto skip_optional;
- }
- if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
- goto exit;
- }
-skip_optional:
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
+ goto exit;
+ }
+skip_optional:
return_value = _io__WindowsConsoleIO_read_impl(self, size);
exit:
@@ -309,13 +309,13 @@ _io__WindowsConsoleIO_write(winconsoleio *self, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer b = {NULL, NULL};
- if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) {
- goto exit;
- }
- if (!PyBuffer_IsContiguous(&b, 'C')) {
- _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ if (PyObject_GetBuffer(arg, &b, PyBUF_SIMPLE) != 0) {
goto exit;
}
+ if (!PyBuffer_IsContiguous(&b, 'C')) {
+ _PyArg_BadArgument("write", "argument", "contiguous buffer", arg);
+ goto exit;
+ }
return_value = _io__WindowsConsoleIO_write_impl(self, &b);
exit:
@@ -386,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=f5b8860a658a001a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f5b8860a658a001a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_io/fileio.c b/contrib/tools/python3/src/Modules/_io/fileio.c
index 048484bde5..20d8928563 100644
--- a/contrib/tools/python3/src/Modules/_io/fileio.c
+++ b/contrib/tools/python3/src/Modules/_io/fileio.c
@@ -2,9 +2,9 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_object.h"
-#include "structmember.h" // PyMemberDef
-#include <stdbool.h>
+#include "pycore_object.h"
+#include "structmember.h" // PyMemberDef
+#include <stdbool.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -76,7 +76,7 @@ _Py_IDENTIFIER(name);
#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type))
/* Forward declarations */
-static PyObject* portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_error);
+static PyObject* portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_error);
int
_PyFileIO_closed(PyObject *self)
@@ -146,8 +146,8 @@ _io_FileIO_close_impl(fileio *self)
PyObject *exc, *val, *tb;
int rc;
_Py_IDENTIFIER(close);
- res = _PyObject_CallMethodIdOneArg((PyObject*)&PyRawIOBase_Type,
- &PyId_close, (PyObject *)self);
+ res = _PyObject_CallMethodIdOneArg((PyObject*)&PyRawIOBase_Type,
+ &PyId_close, (PyObject *)self);
if (!self->closefd) {
self->fd = -1;
return res;
@@ -276,10 +276,10 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
if (!PyUnicode_FSDecoder(nameobj, &stringobj)) {
return -1;
}
-_Py_COMP_DIAG_PUSH
-_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
widename = PyUnicode_AsUnicode(stringobj);
-_Py_COMP_DIAG_POP
+_Py_COMP_DIAG_POP
if (widename == NULL)
return -1;
#else
@@ -362,10 +362,10 @@ _Py_COMP_DIAG_POP
flags |= O_CLOEXEC;
#endif
- if (PySys_Audit("open", "Osi", nameobj, mode, flags) < 0) {
- goto error;
- }
-
+ if (PySys_Audit("open", "Osi", nameobj, mode, flags) < 0) {
+ goto error;
+ }
+
if (fd >= 0) {
self->fd = fd;
self->closefd = closefd;
@@ -484,7 +484,7 @@ _Py_COMP_DIAG_POP
/* For consistent behaviour, we explicitly seek to the
end of file (otherwise, it might be done only on the
first write()). */
- PyObject *pos = portable_lseek(self, NULL, 2, true);
+ PyObject *pos = portable_lseek(self, NULL, 2, true);
if (pos == NULL)
goto error;
Py_DECREF(pos);
@@ -607,7 +607,7 @@ _io_FileIO_seekable_impl(fileio *self)
return err_closed();
if (self->seekable < 0) {
/* portable_lseek() sets the seekable attribute */
- PyObject *pos = portable_lseek(self, NULL, SEEK_CUR, false);
+ PyObject *pos = portable_lseek(self, NULL, SEEK_CUR, false);
assert(self->seekable >= 0);
if (pos == NULL) {
PyErr_Clear();
@@ -874,7 +874,7 @@ _io_FileIO_write_impl(fileio *self, Py_buffer *b)
/* Cribbed from posix_lseek() */
static PyObject *
-portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_error)
+portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_error)
{
Py_off_t pos, res;
int fd = self->fd;
@@ -925,13 +925,13 @@ portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_er
self->seekable = (res >= 0);
}
- if (res < 0) {
- if (suppress_pipe_error && errno == ESPIPE) {
- res = 0;
- } else {
- return PyErr_SetFromErrno(PyExc_OSError);
- }
- }
+ if (res < 0) {
+ if (suppress_pipe_error && errno == ESPIPE) {
+ res = 0;
+ } else {
+ return PyErr_SetFromErrno(PyExc_OSError);
+ }
+ }
#if defined(HAVE_LARGEFILE_SUPPORT)
return PyLong_FromLongLong(res);
@@ -964,7 +964,7 @@ _io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence)
if (self->fd < 0)
return err_closed();
- return portable_lseek(self, pos, whence, false);
+ return portable_lseek(self, pos, whence, false);
}
/*[clinic input]
@@ -982,13 +982,13 @@ _io_FileIO_tell_impl(fileio *self)
if (self->fd < 0)
return err_closed();
- return portable_lseek(self, NULL, 1, false);
+ return portable_lseek(self, NULL, 1, false);
}
#ifdef HAVE_FTRUNCATE
/*[clinic input]
_io.FileIO.truncate
- size as posobj: object = None
+ size as posobj: object = None
/
Truncate the file to at most size bytes and return the truncated size.
@@ -999,7 +999,7 @@ The current file position is changed to the value of size.
static PyObject *
_io_FileIO_truncate_impl(fileio *self, PyObject *posobj)
-/*[clinic end generated code: output=e49ca7a916c176fa input=b0ac133939823875]*/
+/*[clinic end generated code: output=e49ca7a916c176fa input=b0ac133939823875]*/
{
Py_off_t pos;
int ret;
@@ -1011,9 +1011,9 @@ _io_FileIO_truncate_impl(fileio *self, PyObject *posobj)
if (!self->writable)
return err_mode("writing");
- if (posobj == Py_None) {
+ if (posobj == Py_None) {
/* Get the current position. */
- posobj = portable_lseek(self, NULL, 1, false);
+ posobj = portable_lseek(self, NULL, 1, false);
if (posobj == NULL)
return NULL;
}
@@ -1194,10 +1194,10 @@ PyTypeObject PyFileIO_Type = {
sizeof(fileio),
0,
(destructor)fileio_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
(reprfunc)fileio_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -1209,12 +1209,12 @@ PyTypeObject PyFileIO_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io_FileIO___init____doc__, /* tp_doc */
(traverseproc)fileio_traverse, /* tp_traverse */
(inquiry)fileio_clear, /* tp_clear */
0, /* tp_richcompare */
- offsetof(fileio, weakreflist), /* tp_weaklistoffset */
+ offsetof(fileio, weakreflist), /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
fileio_methods, /* tp_methods */
@@ -1224,7 +1224,7 @@ PyTypeObject PyFileIO_Type = {
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
- offsetof(fileio, dict), /* tp_dictoffset */
+ offsetof(fileio, dict), /* tp_dictoffset */
_io_FileIO___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
fileio_new, /* tp_new */
diff --git a/contrib/tools/python3/src/Modules/_io/iobase.c b/contrib/tools/python3/src/Modules/_io/iobase.c
index a8e55c3479..22f3fc0c43 100644
--- a/contrib/tools/python3/src/Modules/_io/iobase.c
+++ b/contrib/tools/python3/src/Modules/_io/iobase.c
@@ -10,8 +10,8 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_object.h"
-#include <stddef.h> // offsetof()
+#include "pycore_object.h"
+#include <stddef.h> // offsetof()
#include "_iomodule.h"
/*[clinic input]
@@ -235,7 +235,7 @@ _io__IOBase_close_impl(PyObject *self)
Py_RETURN_NONE;
}
- res = PyObject_CallMethodNoArgs(self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs(self, _PyIO_str_flush);
PyErr_Fetch(&exc, &val, &tb);
rc = _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True);
@@ -281,25 +281,25 @@ iobase_finalize(PyObject *self)
finalization process. */
if (_PyObject_SetAttrId(self, &PyId__finalizing, Py_True))
PyErr_Clear();
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_close);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_close);
/* Silencing I/O errors is bad, but printing spurious tracebacks is
equally as bad, and potentially more frequent (because of
shutdown issues). */
- if (res == NULL) {
-#ifndef Py_DEBUG
- if (_Py_GetConfig()->dev_mode) {
- PyErr_WriteUnraisable(self);
- }
- else {
- PyErr_Clear();
- }
-#else
- PyErr_WriteUnraisable(self);
-#endif
- }
- else {
+ if (res == NULL) {
+#ifndef Py_DEBUG
+ if (_Py_GetConfig()->dev_mode) {
+ PyErr_WriteUnraisable(self);
+ }
+ else {
+ PyErr_Clear();
+ }
+#else
+ PyErr_WriteUnraisable(self);
+#endif
+ }
+ else {
Py_DECREF(res);
- }
+ }
}
/* Restore the saved exception. */
@@ -381,7 +381,7 @@ _io__IOBase_seekable_impl(PyObject *self)
PyObject *
_PyIOBase_check_seekable(PyObject *self, PyObject *args)
{
- PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_seekable);
+ PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_seekable);
if (res == NULL)
return NULL;
if (res != Py_True) {
@@ -414,7 +414,7 @@ _io__IOBase_readable_impl(PyObject *self)
PyObject *
_PyIOBase_check_readable(PyObject *self, PyObject *args)
{
- PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_readable);
+ PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_readable);
if (res == NULL)
return NULL;
if (res != Py_True) {
@@ -447,7 +447,7 @@ _io__IOBase_writable_impl(PyObject *self)
PyObject *
_PyIOBase_check_writable(PyObject *self, PyObject *args)
{
- PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_writable);
+ PyObject *res = PyObject_CallMethodNoArgs(self, _PyIO_str_writable);
if (res == NULL)
return NULL;
if (res != Py_True) {
@@ -476,7 +476,7 @@ iobase_enter(PyObject *self, PyObject *args)
static PyObject *
iobase_exit(PyObject *self, PyObject *args)
{
- return PyObject_CallMethodNoArgs(self, _PyIO_str_close);
+ return PyObject_CallMethodNoArgs(self, _PyIO_str_close);
}
/* Lower-level APIs */
@@ -555,7 +555,7 @@ _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit)
PyObject *b;
if (peek != NULL) {
- PyObject *readahead = PyObject_CallOneArg(peek, _PyLong_One);
+ PyObject *readahead = PyObject_CallOneArg(peek, _PyLong_One);
if (readahead == NULL) {
/* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals()
when EINTR occurs so we needn't do it ourselves. */
@@ -654,7 +654,7 @@ iobase_iter(PyObject *self)
static PyObject *
iobase_iternext(PyObject *self)
{
- PyObject *line = PyObject_CallMethodNoArgs(self, _PyIO_str_readline);
+ PyObject *line = PyObject_CallMethodNoArgs(self, _PyIO_str_readline);
if (line == NULL)
return NULL;
@@ -749,16 +749,16 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint)
_io._IOBase.writelines
lines: object
/
-
-Write a list of lines to stream.
-
-Line separators are not added, so it is usual for each of the
-lines provided to have a line separator at the end.
+
+Write a list of lines to stream.
+
+Line separators are not added, so it is usual for each of the
+lines provided to have a line separator at the end.
[clinic start generated code]*/
static PyObject *
_io__IOBase_writelines(PyObject *self, PyObject *lines)
-/*[clinic end generated code: output=976eb0a9b60a6628 input=cac3fc8864183359]*/
+/*[clinic end generated code: output=976eb0a9b60a6628 input=cac3fc8864183359]*/
{
PyObject *iter, *res;
@@ -839,10 +839,10 @@ PyTypeObject PyIOBase_Type = {
sizeof(iobase), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)iobase_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -854,7 +854,7 @@ PyTypeObject PyIOBase_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
iobase_doc, /* tp_doc */
(traverseproc)iobase_traverse, /* tp_traverse */
(inquiry)iobase_clear, /* tp_clear */
@@ -919,7 +919,7 @@ _io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n)
if (n < 0) {
_Py_IDENTIFIER(readall);
- return _PyObject_CallMethodIdNoArgs(self, &PyId_readall);
+ return _PyObject_CallMethodIdNoArgs(self, &PyId_readall);
}
/* TODO: allocate a bytes object directly instead and manually construct
@@ -1035,10 +1035,10 @@ PyTypeObject PyRawIOBase_Type = {
0, /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -1049,7 +1049,7 @@ PyTypeObject PyRawIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
rawiobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/contrib/tools/python3/src/Modules/_io/stringio.c b/contrib/tools/python3/src/Modules/_io/stringio.c
index e76152e617..136d80cd3f 100644
--- a/contrib/tools/python3/src/Modules/_io/stringio.c
+++ b/contrib/tools/python3/src/Modules/_io/stringio.c
@@ -1,8 +1,8 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include <stddef.h> // offsetof()
-#include "pycore_accu.h"
-#include "pycore_object.h"
+#include <stddef.h> // offsetof()
+#include "pycore_accu.h"
+#include "pycore_object.h"
#include "_iomodule.h"
/* Implementation note: the buffer is always at least one character longer
@@ -402,14 +402,14 @@ stringio_iternext(stringio *self)
CHECK_CLOSED(self);
ENSURE_REALIZED(self);
- if (Py_IS_TYPE(self, &PyStringIO_Type)) {
+ if (Py_IS_TYPE(self, &PyStringIO_Type)) {
/* Skip method call overhead for speed */
line = _stringio_readline(self, -1);
}
else {
/* XXX is subclassing StringIO really supported? */
- line = PyObject_CallMethodNoArgs((PyObject *)self,
- _PyIO_str_readline);
+ line = PyObject_CallMethodNoArgs((PyObject *)self,
+ _PyIO_str_readline);
if (line && !PyUnicode_Check(line)) {
PyErr_Format(PyExc_OSError,
"readline() should have returned a str object, "
@@ -714,9 +714,9 @@ _io_StringIO___init___impl(stringio *self, PyObject *value,
}
if (self->readuniversal) {
- self->decoder = PyObject_CallFunctionObjArgs(
+ self->decoder = PyObject_CallFunctionObjArgs(
(PyObject *)&PyIncrementalNewlineDecoder_Type,
- Py_None, self->readtranslate ? Py_True : Py_False, NULL);
+ Py_None, self->readtranslate ? Py_True : Py_False, NULL);
if (self->decoder == NULL)
return -1;
}
@@ -813,7 +813,7 @@ _io_StringIO_seekable_impl(stringio *self)
*/
static PyObject *
-stringio_getstate(stringio *self, PyObject *Py_UNUSED(ignored))
+stringio_getstate(stringio *self, PyObject *Py_UNUSED(ignored))
{
PyObject *initvalue = _io_StringIO_getvalue_impl(self);
PyObject *dict;
@@ -899,7 +899,7 @@ stringio_setstate(stringio *self, PyObject *state)
/* Set carefully the position value. Alternatively, we could use the seek
method instead of modifying self->pos directly to better protect the
- object internal state against erroneous (or malicious) inputs. */
+ object internal state against erroneous (or malicious) inputs. */
position_obj = PyTuple_GET_ITEM(state, 2);
if (!PyLong_Check(position_obj)) {
PyErr_Format(PyExc_TypeError,
@@ -1007,10 +1007,10 @@ PyTypeObject PyStringIO_Type = {
sizeof(stringio), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)stringio_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
diff --git a/contrib/tools/python3/src/Modules/_io/textio.c b/contrib/tools/python3/src/Modules/_io/textio.c
index 966c532a0e..a3ea57d0b3 100644
--- a/contrib/tools/python3/src/Modules/_io/textio.c
+++ b/contrib/tools/python3/src/Modules/_io/textio.c
@@ -8,10 +8,10 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_interp.h" // PyInterpreterState.fs_codec
-#include "pycore_object.h"
-#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "structmember.h" // PyMemberDef
+#include "pycore_interp.h" // PyInterpreterState.fs_codec
+#include "pycore_object.h"
+#include "pycore_pystate.h" // _PyInterpreterState_GET()
+#include "structmember.h" // PyMemberDef
#include "_iomodule.h"
/*[clinic input]
@@ -69,7 +69,7 @@ PyDoc_STRVAR(textiobase_detach_doc,
);
static PyObject *
-textiobase_detach(PyObject *self, PyObject *Py_UNUSED(ignored))
+textiobase_detach(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _unsupported("detach");
}
@@ -151,7 +151,7 @@ textiobase_errors_get(PyObject *self, void *context)
static PyMethodDef textiobase_methods[] = {
- {"detach", textiobase_detach, METH_NOARGS, textiobase_detach_doc},
+ {"detach", textiobase_detach, METH_NOARGS, textiobase_detach_doc},
{"read", textiobase_read, METH_VARARGS, textiobase_read_doc},
{"readline", textiobase_readline, METH_VARARGS, textiobase_readline_doc},
{"write", textiobase_write, METH_VARARGS, textiobase_write_doc},
@@ -171,10 +171,10 @@ PyTypeObject PyTextIOBase_Type = {
0, /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -185,7 +185,7 @@ PyTypeObject PyTextIOBase_Type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
textiobase_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -342,7 +342,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
goto error;
kind = PyUnicode_KIND(modified);
out = PyUnicode_DATA(modified);
- PyUnicode_WRITE(kind, out, 0, '\r');
+ PyUnicode_WRITE(kind, out, 0, '\r');
memcpy(out + kind, PyUnicode_DATA(output), kind * output_len);
Py_DECREF(output);
output = modified; /* output remains ready */
@@ -369,7 +369,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
/* Record which newlines are read and do newline translation if desired,
all in one pass. */
{
- const void *in_str;
+ const void *in_str;
Py_ssize_t len;
int seennl = self->seennl;
int only_lf = 0;
@@ -449,7 +449,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
else {
void *translated;
int kind = PyUnicode_KIND(output);
- const void *in_str = PyUnicode_DATA(output);
+ const void *in_str = PyUnicode_DATA(output);
Py_ssize_t in, out;
/* XXX: Previous in-place translation here is disabled as
resizing is not possible anymore */
@@ -529,8 +529,8 @@ _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self)
unsigned long long flag;
if (self->decoder != Py_None) {
- PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
- _PyIO_str_getstate);
+ PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
+ _PyIO_str_getstate);
if (state == NULL)
return NULL;
if (!PyTuple_Check(state)) {
@@ -603,7 +603,7 @@ _io_IncrementalNewlineDecoder_reset_impl(nldecoder_object *self)
self->seennl = 0;
self->pendingcr = 0;
if (self->decoder != Py_None)
- return PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
+ return PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
else
Py_RETURN_NONE;
}
@@ -675,8 +675,8 @@ typedef struct
*/
PyObject *decoded_chars; /* buffer for text returned from decoder */
Py_ssize_t decoded_chars_used; /* offset into _decoded_chars for read() */
- PyObject *pending_bytes; // data waiting to be written.
- // ascii unicode, bytes, or list of them.
+ PyObject *pending_bytes; // data waiting to be written.
+ // ascii unicode, bytes, or list of them.
Py_ssize_t pending_bytes_count;
/* snapshot is either NULL, or a tuple (dec_flags, next_input) where
@@ -778,15 +778,15 @@ latin1_encode(textio *self, PyObject *text)
return _PyUnicode_AsLatin1String(text, PyUnicode_AsUTF8(self->errors));
}
-// Return true when encoding can be skipped when text is ascii.
-static inline int
-is_asciicompat_encoding(encodefunc_t f)
-{
- return f == (encodefunc_t) ascii_encode
- || f == (encodefunc_t) latin1_encode
- || f == (encodefunc_t) utf8_encode;
-}
-
+// Return true when encoding can be skipped when text is ascii.
+static inline int
+is_asciicompat_encoding(encodefunc_t f)
+{
+ return f == (encodefunc_t) ascii_encode
+ || f == (encodefunc_t) latin1_encode
+ || f == (encodefunc_t) utf8_encode;
+}
+
/* Map normalized encoding names onto the specialized encoding funcs */
typedef struct {
@@ -864,7 +864,7 @@ _textiowrapper_set_decoder(textio *self, PyObject *codec_info,
PyObject *res;
int r;
- res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_readable);
+ res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_readable);
if (res == NULL)
return -1;
@@ -882,9 +882,9 @@ _textiowrapper_set_decoder(textio *self, PyObject *codec_info,
return -1;
if (self->readuniversal) {
- PyObject *incrementalDecoder = PyObject_CallFunctionObjArgs(
+ PyObject *incrementalDecoder = PyObject_CallFunctionObjArgs(
(PyObject *)&PyIncrementalNewlineDecoder_Type,
- self->decoder, self->readtranslate ? Py_True : Py_False, NULL);
+ self->decoder, self->readtranslate ? Py_True : Py_False, NULL);
if (incrementalDecoder == NULL)
return -1;
Py_CLEAR(self->decoder);
@@ -899,7 +899,7 @@ _textiowrapper_decode(PyObject *decoder, PyObject *bytes, int eof)
{
PyObject *chars;
- if (Py_IS_TYPE(decoder, &PyIncrementalNewlineDecoder_Type))
+ if (Py_IS_TYPE(decoder, &PyIncrementalNewlineDecoder_Type))
chars = _PyIncrementalNewlineDecoder_decode(decoder, bytes, eof);
else
chars = PyObject_CallMethodObjArgs(decoder, _PyIO_str_decode, bytes,
@@ -919,7 +919,7 @@ _textiowrapper_set_encoder(textio *self, PyObject *codec_info,
PyObject *res;
int r;
- res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_writable);
+ res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_writable);
if (res == NULL)
return -1;
@@ -965,8 +965,8 @@ _textiowrapper_fix_encoder_state(textio *self)
self->encoding_start_of_stream = 1;
- PyObject *cookieObj = PyObject_CallMethodNoArgs(
- self->buffer, _PyIO_str_tell);
+ PyObject *cookieObj = PyObject_CallMethodNoArgs(
+ self->buffer, _PyIO_str_tell);
if (cookieObj == NULL) {
return -1;
}
@@ -979,8 +979,8 @@ _textiowrapper_fix_encoder_state(textio *self)
if (cmp == 0) {
self->encoding_start_of_stream = 0;
- PyObject *res = PyObject_CallMethodOneArg(
- self->encoder, _PyIO_str_setstate, _PyLong_Zero);
+ PyObject *res = PyObject_CallMethodOneArg(
+ self->encoder, _PyIO_str_setstate, _PyLong_Zero);
if (res == NULL) {
return -1;
}
@@ -990,52 +990,52 @@ _textiowrapper_fix_encoder_state(textio *self)
return 0;
}
-static int
-io_check_errors(PyObject *errors)
-{
- assert(errors != NULL && errors != Py_None);
-
- PyInterpreterState *interp = _PyInterpreterState_GET();
-#ifndef Py_DEBUG
- /* In release mode, only check in development mode (-X dev) */
- if (!_PyInterpreterState_GetConfig(interp)->dev_mode) {
- return 0;
- }
-#else
- /* Always check in debug mode */
-#endif
-
- /* Avoid calling PyCodec_LookupError() before the codec registry is ready:
- before_PyUnicode_InitEncodings() is called. */
- if (!interp->unicode.fs_codec.encoding) {
- return 0;
- }
-
- Py_ssize_t name_length;
- const char *name = PyUnicode_AsUTF8AndSize(errors, &name_length);
- if (name == NULL) {
- return -1;
- }
- if (strlen(name) != (size_t)name_length) {
- PyErr_SetString(PyExc_ValueError, "embedded null character in errors");
- return -1;
- }
- PyObject *handler = PyCodec_LookupError(name);
- if (handler != NULL) {
- Py_DECREF(handler);
- return 0;
- }
- return -1;
-}
-
-
-
+static int
+io_check_errors(PyObject *errors)
+{
+ assert(errors != NULL && errors != Py_None);
+
+ PyInterpreterState *interp = _PyInterpreterState_GET();
+#ifndef Py_DEBUG
+ /* In release mode, only check in development mode (-X dev) */
+ if (!_PyInterpreterState_GetConfig(interp)->dev_mode) {
+ return 0;
+ }
+#else
+ /* Always check in debug mode */
+#endif
+
+ /* Avoid calling PyCodec_LookupError() before the codec registry is ready:
+ before_PyUnicode_InitEncodings() is called. */
+ if (!interp->unicode.fs_codec.encoding) {
+ return 0;
+ }
+
+ Py_ssize_t name_length;
+ const char *name = PyUnicode_AsUTF8AndSize(errors, &name_length);
+ if (name == NULL) {
+ return -1;
+ }
+ if (strlen(name) != (size_t)name_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character in errors");
+ return -1;
+ }
+ PyObject *handler = PyCodec_LookupError(name);
+ if (handler != NULL) {
+ Py_DECREF(handler);
+ return 0;
+ }
+ return -1;
+}
+
+
+
/*[clinic input]
_io.TextIOWrapper.__init__
buffer: object
- encoding: str(accept={str, NoneType}) = None
+ encoding: str(accept={str, NoneType}) = None
errors: object = None
- newline: str(accept={str, NoneType}) = None
+ newline: str(accept={str, NoneType}) = None
line_buffering: bool(accept={int}) = False
write_through: bool(accept={int}) = False
@@ -1074,7 +1074,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
const char *encoding, PyObject *errors,
const char *newline, int line_buffering,
int write_through)
-/*[clinic end generated code: output=72267c0c01032ed2 input=77d8696d1a1f460b]*/
+/*[clinic end generated code: output=72267c0c01032ed2 input=77d8696d1a1f460b]*/
{
PyObject *raw, *codec_info = NULL;
_PyIO_State *state = NULL;
@@ -1096,12 +1096,12 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
PyErr_Format(
PyExc_TypeError,
"TextIOWrapper() argument 'errors' must be str or None, not %.50s",
- Py_TYPE(errors)->tp_name);
- return -1;
- }
- else if (io_check_errors(errors)) {
+ Py_TYPE(errors)->tp_name);
return -1;
}
+ else if (io_check_errors(errors)) {
+ return -1;
+ }
if (validate_newline(newline) < 0) {
return -1;
@@ -1128,7 +1128,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
state = IO_STATE();
if (state == NULL)
goto error;
- fileno = _PyObject_CallMethodIdNoArgs(buffer, &PyId_fileno);
+ fileno = _PyObject_CallMethodIdNoArgs(buffer, &PyId_fileno);
/* Ignore only AttributeError and UnsupportedOperation */
if (fileno == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError) ||
@@ -1157,8 +1157,8 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
PyObject *locale_module = _PyIO_get_locale_module(state);
if (locale_module == NULL)
goto catch_ImportError;
- self->encoding = _PyObject_CallMethodIdOneArg(
- locale_module, &PyId_getpreferredencoding, Py_False);
+ self->encoding = _PyObject_CallMethodIdOneArg(
+ locale_module, &PyId_getpreferredencoding, Py_False);
Py_DECREF(locale_module);
if (self->encoding == NULL) {
catch_ImportError:
@@ -1228,22 +1228,22 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
/* Finished sorting out the codec details */
Py_CLEAR(codec_info);
- if (Py_IS_TYPE(buffer, &PyBufferedReader_Type) ||
- Py_IS_TYPE(buffer, &PyBufferedWriter_Type) ||
- Py_IS_TYPE(buffer, &PyBufferedRandom_Type))
+ if (Py_IS_TYPE(buffer, &PyBufferedReader_Type) ||
+ Py_IS_TYPE(buffer, &PyBufferedWriter_Type) ||
+ Py_IS_TYPE(buffer, &PyBufferedRandom_Type))
{
if (_PyObject_LookupAttrId(buffer, &PyId_raw, &raw) < 0)
goto error;
/* Cache the raw FileIO object to speed up 'closed' checks */
if (raw != NULL) {
- if (Py_IS_TYPE(raw, &PyFileIO_Type))
+ if (Py_IS_TYPE(raw, &PyFileIO_Type))
self->raw = raw;
else
Py_DECREF(raw);
}
}
- res = _PyObject_CallMethodIdNoArgs(buffer, &PyId_seekable);
+ res = _PyObject_CallMethodIdNoArgs(buffer, &PyId_seekable);
if (res == NULL)
goto error;
r = PyObject_IsTrue(res);
@@ -1388,7 +1388,7 @@ _io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
return NULL;
}
- PyObject *res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ PyObject *res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL) {
return NULL;
}
@@ -1468,7 +1468,7 @@ textiowrapper_closed_get(textio *self, void *context);
do { \
int r; \
PyObject *_res; \
- if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) { \
+ if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) { \
if (self->raw != NULL) \
r = _PyFileIO_closed(self->raw); \
else { \
@@ -1527,7 +1527,7 @@ _io_TextIOWrapper_detach_impl(textio *self)
{
PyObject *buffer, *res;
CHECK_ATTACHED(self);
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL)
return NULL;
Py_DECREF(res);
@@ -1545,65 +1545,65 @@ _textiowrapper_writeflush(textio *self)
if (self->pending_bytes == NULL)
return 0;
- PyObject *pending = self->pending_bytes;
- PyObject *b;
-
- if (PyBytes_Check(pending)) {
- b = pending;
- Py_INCREF(b);
- }
- else if (PyUnicode_Check(pending)) {
- assert(PyUnicode_IS_ASCII(pending));
- assert(PyUnicode_GET_LENGTH(pending) == self->pending_bytes_count);
- b = PyBytes_FromStringAndSize(
- PyUnicode_DATA(pending), PyUnicode_GET_LENGTH(pending));
- if (b == NULL) {
- return -1;
- }
- }
- else {
- assert(PyList_Check(pending));
- b = PyBytes_FromStringAndSize(NULL, self->pending_bytes_count);
- if (b == NULL) {
- return -1;
- }
-
- char *buf = PyBytes_AsString(b);
- Py_ssize_t pos = 0;
-
- for (Py_ssize_t i = 0; i < PyList_GET_SIZE(pending); i++) {
- PyObject *obj = PyList_GET_ITEM(pending, i);
- char *src;
- Py_ssize_t len;
- if (PyUnicode_Check(obj)) {
- assert(PyUnicode_IS_ASCII(obj));
- src = PyUnicode_DATA(obj);
- len = PyUnicode_GET_LENGTH(obj);
- }
- else {
- assert(PyBytes_Check(obj));
- if (PyBytes_AsStringAndSize(obj, &src, &len) < 0) {
- Py_DECREF(b);
- return -1;
- }
- }
- memcpy(buf + pos, src, len);
- pos += len;
- }
- assert(pos == self->pending_bytes_count);
- }
-
+ PyObject *pending = self->pending_bytes;
+ PyObject *b;
+
+ if (PyBytes_Check(pending)) {
+ b = pending;
+ Py_INCREF(b);
+ }
+ else if (PyUnicode_Check(pending)) {
+ assert(PyUnicode_IS_ASCII(pending));
+ assert(PyUnicode_GET_LENGTH(pending) == self->pending_bytes_count);
+ b = PyBytes_FromStringAndSize(
+ PyUnicode_DATA(pending), PyUnicode_GET_LENGTH(pending));
+ if (b == NULL) {
+ return -1;
+ }
+ }
+ else {
+ assert(PyList_Check(pending));
+ b = PyBytes_FromStringAndSize(NULL, self->pending_bytes_count);
+ if (b == NULL) {
+ return -1;
+ }
+
+ char *buf = PyBytes_AsString(b);
+ Py_ssize_t pos = 0;
+
+ for (Py_ssize_t i = 0; i < PyList_GET_SIZE(pending); i++) {
+ PyObject *obj = PyList_GET_ITEM(pending, i);
+ char *src;
+ Py_ssize_t len;
+ if (PyUnicode_Check(obj)) {
+ assert(PyUnicode_IS_ASCII(obj));
+ src = PyUnicode_DATA(obj);
+ len = PyUnicode_GET_LENGTH(obj);
+ }
+ else {
+ assert(PyBytes_Check(obj));
+ if (PyBytes_AsStringAndSize(obj, &src, &len) < 0) {
+ Py_DECREF(b);
+ return -1;
+ }
+ }
+ memcpy(buf + pos, src, len);
+ pos += len;
+ }
+ assert(pos == self->pending_bytes_count);
+ }
+
self->pending_bytes_count = 0;
- self->pending_bytes = NULL;
- Py_DECREF(pending);
+ self->pending_bytes = NULL;
+ Py_DECREF(pending);
- PyObject *ret;
+ PyObject *ret;
do {
- ret = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_write, b);
+ ret = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_write, b);
} while (ret == NULL && _PyIO_trap_eintr());
Py_DECREF(b);
- // NOTE: We cleared buffer but we don't know how many bytes are actually written
- // when an error occurred.
+ // NOTE: We cleared buffer but we don't know how many bytes are actually written
+ // when an error occurred.
if (ret == NULL)
return -1;
Py_DECREF(ret);
@@ -1661,26 +1661,26 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
/* XXX What if we were just reading? */
if (self->encodefunc != NULL) {
- if (PyUnicode_IS_ASCII(text) &&
- // See bpo-43260
- PyUnicode_GET_LENGTH(text) <= self->chunk_size &&
- is_asciicompat_encoding(self->encodefunc)) {
- b = text;
- Py_INCREF(b);
- }
- else {
- b = (*self->encodefunc)((PyObject *) self, text);
- }
+ if (PyUnicode_IS_ASCII(text) &&
+ // See bpo-43260
+ PyUnicode_GET_LENGTH(text) <= self->chunk_size &&
+ is_asciicompat_encoding(self->encodefunc)) {
+ b = text;
+ Py_INCREF(b);
+ }
+ else {
+ b = (*self->encodefunc)((PyObject *) self, text);
+ }
self->encoding_start_of_stream = 0;
}
- else {
- b = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text);
- }
-
+ else {
+ b = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_encode, text);
+ }
+
Py_DECREF(text);
if (b == NULL)
return NULL;
- if (b != text && !PyBytes_Check(b)) {
+ if (b != text && !PyBytes_Check(b)) {
PyErr_Format(PyExc_TypeError,
"encoder should return a bytes object, not '%.200s'",
Py_TYPE(b)->tp_name);
@@ -1688,53 +1688,53 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
return NULL;
}
- Py_ssize_t bytes_len;
- if (b == text) {
- bytes_len = PyUnicode_GET_LENGTH(b);
- }
- else {
- bytes_len = PyBytes_GET_SIZE(b);
- }
-
+ Py_ssize_t bytes_len;
+ if (b == text) {
+ bytes_len = PyUnicode_GET_LENGTH(b);
+ }
+ else {
+ bytes_len = PyBytes_GET_SIZE(b);
+ }
+
if (self->pending_bytes == NULL) {
- self->pending_bytes_count = 0;
- self->pending_bytes = b;
- }
- else if (self->pending_bytes_count + bytes_len > self->chunk_size) {
- // Prevent to concatenate more than chunk_size data.
- if (_textiowrapper_writeflush(self) < 0) {
+ self->pending_bytes_count = 0;
+ self->pending_bytes = b;
+ }
+ else if (self->pending_bytes_count + bytes_len > self->chunk_size) {
+ // Prevent to concatenate more than chunk_size data.
+ if (_textiowrapper_writeflush(self) < 0) {
+ Py_DECREF(b);
+ return NULL;
+ }
+ self->pending_bytes = b;
+ }
+ else if (!PyList_CheckExact(self->pending_bytes)) {
+ PyObject *list = PyList_New(2);
+ if (list == NULL) {
Py_DECREF(b);
return NULL;
}
- self->pending_bytes = b;
+ PyList_SET_ITEM(list, 0, self->pending_bytes);
+ PyList_SET_ITEM(list, 1, b);
+ self->pending_bytes = list;
}
- else if (!PyList_CheckExact(self->pending_bytes)) {
- PyObject *list = PyList_New(2);
- if (list == NULL) {
- Py_DECREF(b);
- return NULL;
- }
- PyList_SET_ITEM(list, 0, self->pending_bytes);
- PyList_SET_ITEM(list, 1, b);
- self->pending_bytes = list;
- }
- else {
- if (PyList_Append(self->pending_bytes, b) < 0) {
- Py_DECREF(b);
- return NULL;
- }
+ else {
+ if (PyList_Append(self->pending_bytes, b) < 0) {
+ Py_DECREF(b);
+ return NULL;
+ }
Py_DECREF(b);
}
-
- self->pending_bytes_count += bytes_len;
- if (self->pending_bytes_count >= self->chunk_size || needflush ||
+
+ self->pending_bytes_count += bytes_len;
+ if (self->pending_bytes_count >= self->chunk_size || needflush ||
text_needflush) {
if (_textiowrapper_writeflush(self) < 0)
return NULL;
}
if (needflush) {
- ret = PyObject_CallMethodNoArgs(self->buffer, _PyIO_str_flush);
+ ret = PyObject_CallMethodNoArgs(self->buffer, _PyIO_str_flush);
if (ret == NULL)
return NULL;
Py_DECREF(ret);
@@ -1744,7 +1744,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
Py_CLEAR(self->snapshot);
if (self->decoder) {
- ret = _PyObject_CallMethodIdNoArgs(self->decoder, &PyId_reset);
+ ret = _PyObject_CallMethodIdNoArgs(self->decoder, &PyId_reset);
if (ret == NULL)
return NULL;
Py_DECREF(ret);
@@ -1824,8 +1824,8 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
/* To prepare for tell(), we need to snapshot a point in the file
* where the decoder's input buffer is empty.
*/
- PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
- _PyIO_str_getstate);
+ PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
+ _PyIO_str_getstate);
if (state == NULL)
return -1;
/* Given this, we know there was a valid snapshot point
@@ -1865,9 +1865,9 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
if (chunk_size == NULL)
goto fail;
- input_chunk = PyObject_CallMethodOneArg(self->buffer,
+ input_chunk = PyObject_CallMethodOneArg(self->buffer,
(self->has_read1 ? _PyIO_str_read1: _PyIO_str_read),
- chunk_size);
+ chunk_size);
Py_DECREF(chunk_size);
if (input_chunk == NULL)
goto fail;
@@ -1948,12 +1948,12 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
if (n < 0) {
/* Read everything */
- PyObject *bytes = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_read);
+ PyObject *bytes = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_read);
PyObject *decoded;
if (bytes == NULL)
goto fail;
- if (Py_IS_TYPE(self->decoder, &PyIncrementalNewlineDecoder_Type))
+ if (Py_IS_TYPE(self->decoder, &PyIncrementalNewlineDecoder_Type))
decoded = _PyIncrementalNewlineDecoder_decode(self->decoder,
bytes, 1);
else
@@ -2041,7 +2041,7 @@ find_control_char(int kind, const char *s, const char *end, Py_UCS4 ch)
{
if (kind == PyUnicode_1BYTE_KIND) {
assert(ch < 256);
- return (char *) memchr((const void *) s, (char) ch, end - s);
+ return (char *) memchr((const void *) s, (char) ch, end - s);
}
for (;;) {
while (PyUnicode_READ(kind, s, 0) > ch)
@@ -2059,7 +2059,7 @@ _PyIO_find_line_ending(
int translated, int universal, PyObject *readnl,
int kind, const char *start, const char *end, Py_ssize_t *consumed)
{
- Py_ssize_t len = (end - start)/kind;
+ Py_ssize_t len = (end - start)/kind;
if (translated) {
/* Newlines are already translated, only search for \n */
@@ -2101,7 +2101,7 @@ _PyIO_find_line_ending(
else {
/* Non-universal mode. */
Py_ssize_t readnl_len = PyUnicode_GET_LENGTH(readnl);
- const Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl);
+ const Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl);
/* Assume that readnl is an ASCII character. */
assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND);
if (readnl_len == 1) {
@@ -2155,7 +2155,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit)
chunked = 0;
while (1) {
- const char *ptr;
+ const char *ptr;
Py_ssize_t line_len;
int kind;
Py_ssize_t consumed = 0;
@@ -2409,7 +2409,7 @@ _textiowrapper_decoder_setstate(textio *self, cookie_type *cookie)
utf-16, that we are expecting a BOM).
*/
if (cookie->start_pos == 0 && cookie->dec_flags == 0)
- res = PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
+ res = PyObject_CallMethodNoArgs(self->decoder, _PyIO_str_reset);
else
res = _PyObject_CallMethodId(self->decoder, &PyId_setstate,
"((yi))", "", cookie->dec_flags);
@@ -2424,12 +2424,12 @@ _textiowrapper_encoder_reset(textio *self, int start_of_stream)
{
PyObject *res;
if (start_of_stream) {
- res = PyObject_CallMethodNoArgs(self->encoder, _PyIO_str_reset);
+ res = PyObject_CallMethodNoArgs(self->encoder, _PyIO_str_reset);
self->encoding_start_of_stream = 1;
}
else {
- res = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_setstate,
- _PyLong_Zero);
+ res = PyObject_CallMethodOneArg(self->encoder, _PyIO_str_setstate,
+ _PyLong_Zero);
self->encoding_start_of_stream = 0;
}
if (res == NULL)
@@ -2473,8 +2473,8 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
goto fail;
}
- switch (whence) {
- case SEEK_CUR:
+ switch (whence) {
+ case SEEK_CUR:
/* seek relative to current position */
cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_EQ);
if (cmp < 0)
@@ -2489,12 +2489,12 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
* sync the underlying buffer with the current position.
*/
Py_DECREF(cookieObj);
- cookieObj = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_tell);
+ cookieObj = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_tell);
if (cookieObj == NULL)
goto fail;
- break;
-
- case SEEK_END:
+ break;
+
+ case SEEK_END:
/* seek relative to end of file */
cmp = PyObject_RichCompareBool(cookieObj, _PyLong_Zero, Py_EQ);
if (cmp < 0)
@@ -2505,7 +2505,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
goto fail;
}
- res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
+ res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
if (res == NULL)
goto fail;
Py_DECREF(res);
@@ -2513,7 +2513,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
textiowrapper_set_decoded_chars(self, NULL);
Py_CLEAR(self->snapshot);
if (self->decoder) {
- res = _PyObject_CallMethodIdNoArgs(self->decoder, &PyId_reset);
+ res = _PyObject_CallMethodIdNoArgs(self->decoder, &PyId_reset);
if (res == NULL)
goto fail;
Py_DECREF(res);
@@ -2532,14 +2532,14 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
}
}
return res;
-
- case SEEK_SET:
- break;
-
- default:
+
+ case SEEK_SET:
+ break;
+
+ default:
PyErr_Format(PyExc_ValueError,
- "invalid whence (%d, should be %d, %d or %d)", whence,
- SEEK_SET, SEEK_CUR, SEEK_END);
+ "invalid whence (%d, should be %d, %d or %d)", whence,
+ SEEK_SET, SEEK_CUR, SEEK_END);
goto fail;
}
@@ -2553,7 +2553,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
goto fail;
}
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL)
goto fail;
Py_DECREF(res);
@@ -2568,7 +2568,7 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
posobj = PyLong_FromOff_t(cookie.start_pos);
if (posobj == NULL)
goto fail;
- res = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_seek, posobj);
+ res = PyObject_CallMethodOneArg(self->buffer, _PyIO_str_seek, posobj);
Py_DECREF(posobj);
if (res == NULL)
goto fail;
@@ -2607,8 +2607,8 @@ _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
}
Py_XSETREF(self->snapshot, snapshot);
- decoded = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_decode,
- input_chunk, cookie.need_eof ? Py_True : Py_False, NULL);
+ decoded = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_decode,
+ input_chunk, cookie.need_eof ? Py_True : Py_False, NULL);
if (check_decoded(decoded) < 0)
goto fail;
@@ -2656,7 +2656,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
Py_ssize_t chars_to_skip, chars_decoded;
Py_ssize_t skip_bytes, skip_back;
PyObject *saved_state = NULL;
- const char *input, *input_end;
+ const char *input, *input_end;
Py_ssize_t dec_buffer_len;
int dec_flags;
@@ -2675,12 +2675,12 @@ _io_TextIOWrapper_tell_impl(textio *self)
if (_textiowrapper_writeflush(self) < 0)
return NULL;
- res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
+ res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
if (res == NULL)
goto fail;
Py_DECREF(res);
- posobj = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_tell);
+ posobj = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_tell);
if (posobj == NULL)
goto fail;
@@ -2716,15 +2716,15 @@ _io_TextIOWrapper_tell_impl(textio *self)
chars_to_skip = self->decoded_chars_used;
/* Decoder state will be restored at the end */
- saved_state = PyObject_CallMethodNoArgs(self->decoder,
- _PyIO_str_getstate);
+ saved_state = PyObject_CallMethodNoArgs(self->decoder,
+ _PyIO_str_getstate);
if (saved_state == NULL)
goto fail;
#define DECODER_GETSTATE() do { \
PyObject *dec_buffer; \
- PyObject *_state = PyObject_CallMethodNoArgs(self->decoder, \
- _PyIO_str_getstate); \
+ PyObject *_state = PyObject_CallMethodNoArgs(self->decoder, \
+ _PyIO_str_getstate); \
if (_state == NULL) \
goto fail; \
if (!PyTuple_Check(_state)) { \
@@ -2835,7 +2835,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
if (input == input_end) {
/* We didn't get enough decoded data; signal EOF to get more. */
PyObject *decoded = _PyObject_CallMethodId(
- self->decoder, &PyId_decode, "yO", "", /* final = */ Py_True);
+ self->decoder, &PyId_decode, "yO", "", /* final = */ Py_True);
if (check_decoded(decoded) < 0)
goto fail;
chars_decoded += PyUnicode_GET_LENGTH(decoded);
@@ -2850,7 +2850,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
}
finally:
- res = _PyObject_CallMethodIdOneArg(self->decoder, &PyId_setstate, saved_state);
+ res = _PyObject_CallMethodIdOneArg(self->decoder, &PyId_setstate, saved_state);
Py_DECREF(saved_state);
if (res == NULL)
return NULL;
@@ -2864,7 +2864,7 @@ fail:
if (saved_state) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
- res = _PyObject_CallMethodIdOneArg(self->decoder, &PyId_setstate, saved_state);
+ res = _PyObject_CallMethodIdOneArg(self->decoder, &PyId_setstate, saved_state);
_PyErr_ChainExceptions(type, value, traceback);
Py_DECREF(saved_state);
Py_XDECREF(res);
@@ -2886,12 +2886,12 @@ _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos)
CHECK_ATTACHED(self)
- res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
+ res = PyObject_CallMethodNoArgs((PyObject *)self, _PyIO_str_flush);
if (res == NULL)
return NULL;
Py_DECREF(res);
- return PyObject_CallMethodOneArg(self->buffer, _PyIO_str_truncate, pos);
+ return PyObject_CallMethodOneArg(self->buffer, _PyIO_str_truncate, pos);
}
static PyObject *
@@ -2915,14 +2915,14 @@ textiowrapper_repr(textio *self)
}
goto error;
}
- if (_PyObject_LookupAttrId((PyObject *) self, &PyId_name, &nameobj) < 0) {
- if (!PyErr_ExceptionMatches(PyExc_ValueError)) {
+ if (_PyObject_LookupAttrId((PyObject *) self, &PyId_name, &nameobj) < 0) {
+ if (!PyErr_ExceptionMatches(PyExc_ValueError)) {
goto error;
- }
- /* Ignore ValueError raised if the underlying stream was detached */
- PyErr_Clear();
+ }
+ /* Ignore ValueError raised if the underlying stream was detached */
+ PyErr_Clear();
}
- if (nameobj != NULL) {
+ if (nameobj != NULL) {
s = PyUnicode_FromFormat(" name=%R", nameobj);
Py_DECREF(nameobj);
if (s == NULL)
@@ -2931,10 +2931,10 @@ textiowrapper_repr(textio *self)
if (res == NULL)
goto error;
}
- if (_PyObject_LookupAttrId((PyObject *) self, &PyId_mode, &modeobj) < 0) {
- goto error;
+ if (_PyObject_LookupAttrId((PyObject *) self, &PyId_mode, &modeobj) < 0) {
+ goto error;
}
- if (modeobj != NULL) {
+ if (modeobj != NULL) {
s = PyUnicode_FromFormat(" mode=%R", modeobj);
Py_DECREF(modeobj);
if (s == NULL)
@@ -2971,7 +2971,7 @@ _io_TextIOWrapper_fileno_impl(textio *self)
/*[clinic end generated code: output=21490a4c3da13e6c input=c488ca83d0069f9b]*/
{
CHECK_ATTACHED(self);
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_fileno);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_fileno);
}
/*[clinic input]
@@ -2983,7 +2983,7 @@ _io_TextIOWrapper_seekable_impl(textio *self)
/*[clinic end generated code: output=ab223dbbcffc0f00 input=8b005ca06e1fca13]*/
{
CHECK_ATTACHED(self);
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_seekable);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_seekable);
}
/*[clinic input]
@@ -2995,7 +2995,7 @@ _io_TextIOWrapper_readable_impl(textio *self)
/*[clinic end generated code: output=72ff7ba289a8a91b input=0704ea7e01b0d3eb]*/
{
CHECK_ATTACHED(self);
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_readable);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_readable);
}
/*[clinic input]
@@ -3007,7 +3007,7 @@ _io_TextIOWrapper_writable_impl(textio *self)
/*[clinic end generated code: output=a728c71790d03200 input=c41740bc9d8636e8]*/
{
CHECK_ATTACHED(self);
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_writable);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_writable);
}
/*[clinic input]
@@ -3019,7 +3019,7 @@ _io_TextIOWrapper_isatty_impl(textio *self)
/*[clinic end generated code: output=12be1a35bace882e input=fb68d9f2c99bbfff]*/
{
CHECK_ATTACHED(self);
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_isatty);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_isatty);
}
/*[clinic input]
@@ -3035,7 +3035,7 @@ _io_TextIOWrapper_flush_impl(textio *self)
self->telling = self->seekable;
if (_textiowrapper_writeflush(self) < 0)
return NULL;
- return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_flush);
+ return _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_flush);
}
/*[clinic input]
@@ -3064,21 +3064,21 @@ _io_TextIOWrapper_close_impl(textio *self)
else {
PyObject *exc = NULL, *val, *tb;
if (self->finalizing) {
- res = _PyObject_CallMethodIdOneArg(self->buffer,
- &PyId__dealloc_warn,
- (PyObject *)self);
+ res = _PyObject_CallMethodIdOneArg(self->buffer,
+ &PyId__dealloc_warn,
+ (PyObject *)self);
if (res)
Py_DECREF(res);
else
PyErr_Clear();
}
- res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
+ res = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_flush);
if (res == NULL)
PyErr_Fetch(&exc, &val, &tb);
else
Py_DECREF(res);
- res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_close);
+ res = _PyObject_CallMethodIdNoArgs(self->buffer, &PyId_close);
if (exc != NULL) {
_PyErr_ChainExceptions(exc, val, tb);
Py_CLEAR(res);
@@ -3095,13 +3095,13 @@ textiowrapper_iternext(textio *self)
CHECK_ATTACHED(self);
self->telling = 0;
- if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) {
+ if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) {
/* Skip method call overhead for speed */
line = _textiowrapper_readline(self, -1);
}
else {
- line = PyObject_CallMethodNoArgs((PyObject *)self,
- _PyIO_str_readline);
+ line = PyObject_CallMethodNoArgs((PyObject *)self,
+ _PyIO_str_readline);
if (line && !PyUnicode_Check(line)) {
PyErr_Format(PyExc_OSError,
"readline() should have returned a str object, "
@@ -3209,10 +3209,10 @@ PyTypeObject PyIncrementalNewlineDecoder_Type = {
sizeof(nldecoder_object), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)incrementalnewlinedecoder_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -3293,10 +3293,10 @@ PyTypeObject PyTextIOWrapper_Type = {
sizeof(textio), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)textiowrapper_dealloc, /*tp_dealloc*/
- 0, /*tp_vectorcall_offset*/
+ 0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tps_etattr*/
- 0, /*tp_as_async*/
+ 0, /*tp_as_async*/
(reprfunc)textiowrapper_repr,/*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -3308,7 +3308,7 @@ PyTypeObject PyTextIOWrapper_Type = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
_io_TextIOWrapper___init____doc__, /* tp_doc */
(traverseproc)textiowrapper_traverse, /* tp_traverse */
(inquiry)textiowrapper_clear, /* tp_clear */
diff --git a/contrib/tools/python3/src/Modules/_io/winconsoleio.c b/contrib/tools/python3/src/Modules/_io/winconsoleio.c
index a83ef37a1f..b243e5380c 100644
--- a/contrib/tools/python3/src/Modules/_io/winconsoleio.c
+++ b/contrib/tools/python3/src/Modules/_io/winconsoleio.c
@@ -8,11 +8,11 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_object.h"
+#include "pycore_object.h"
#ifdef MS_WINDOWS
-#include "structmember.h" // PyMemberDef
+#include "structmember.h" // PyMemberDef
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -204,8 +204,8 @@ _io__WindowsConsoleIO_close_impl(winconsoleio *self)
PyObject *exc, *val, *tb;
int rc;
_Py_IDENTIFIER(close);
- res = _PyObject_CallMethodIdOneArg((PyObject*)&PyRawIOBase_Type,
- &PyId_close, (PyObject*)self);
+ res = _PyObject_CallMethodIdOneArg((PyObject*)&PyRawIOBase_Type,
+ &PyId_close, (PyObject*)self);
if (!self->closehandle) {
self->handle = INVALID_HANDLE_VALUE;
return res;
@@ -557,7 +557,7 @@ read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
Py_BEGIN_ALLOW_THREADS
DWORD off = 0;
while (off < maxlen) {
- DWORD n = (DWORD)-1;
+ DWORD n = (DWORD)-1;
DWORD len = min(maxlen - off, BUFSIZ);
SetLastError(0);
BOOL res = ReadConsoleW(handle, &buf[off], len, &n, NULL);
@@ -725,7 +725,7 @@ readinto(winconsoleio *self, char *buf, Py_ssize_t len)
if (u8n) {
PyErr_Format(PyExc_SystemError,
- "Buffer had room for %zd bytes but %u bytes required",
+ "Buffer had room for %zd bytes but %u bytes required",
len, u8n);
return -1;
}
@@ -1118,10 +1118,10 @@ PyTypeObject PyWindowsConsoleIO_Type = {
sizeof(winconsoleio),
0,
(destructor)winconsoleio_dealloc, /* tp_dealloc */
- 0, /* tp_vectorcall_offset */
+ 0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_as_async */
+ 0, /* tp_as_async */
(reprfunc)winconsoleio_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -1133,7 +1133,7 @@ PyTypeObject PyWindowsConsoleIO_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
- | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+ | Py_TPFLAGS_HAVE_GC, /* tp_flags */
_io__WindowsConsoleIO___init____doc__, /* tp_doc */
(traverseproc)winconsoleio_traverse, /* tp_traverse */
(inquiry)winconsoleio_clear, /* tp_clear */
@@ -1164,6 +1164,6 @@ PyTypeObject PyWindowsConsoleIO_Type = {
0, /* tp_finalize */
};
-PyObject * _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
+PyObject * _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
#endif /* MS_WINDOWS */