1/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(_io__IOBase_tell__doc__,
6"tell($self, /)\n"
7"--\n"
8"\n"
9"Return current stream position.");
10
11#define _IO__IOBASE_TELL_METHODDEF \
12 {"tell", (PyCFunction)_io__IOBase_tell, METH_NOARGS, _io__IOBase_tell__doc__},
13
14static PyObject *
15_io__IOBase_tell_impl(PyObject *self);
16
17static PyObject *
18_io__IOBase_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
19{
20 return _io__IOBase_tell_impl(self);
21}
22
23PyDoc_STRVAR(_io__IOBase_flush__doc__,
24"flush($self, /)\n"
25"--\n"
26"\n"
27"Flush write buffers, if applicable.\n"
28"\n"
29"This is not implemented for read-only and non-blocking streams.");
30
31#define _IO__IOBASE_FLUSH_METHODDEF \
32 {"flush", (PyCFunction)_io__IOBase_flush, METH_NOARGS, _io__IOBase_flush__doc__},
33
34static PyObject *
35_io__IOBase_flush_impl(PyObject *self);
36
37static PyObject *
38_io__IOBase_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
39{
40 return _io__IOBase_flush_impl(self);
41}
42
43PyDoc_STRVAR(_io__IOBase_close__doc__,
44"close($self, /)\n"
45"--\n"
46"\n"
47"Flush and close the IO object.\n"
48"\n"
49"This method has no effect if the file is already closed.");
50
51#define _IO__IOBASE_CLOSE_METHODDEF \
52 {"close", (PyCFunction)_io__IOBase_close, METH_NOARGS, _io__IOBase_close__doc__},
53
54static PyObject *
55_io__IOBase_close_impl(PyObject *self);
56
57static PyObject *
58_io__IOBase_close(PyObject *self, PyObject *Py_UNUSED(ignored))
59{
60 return _io__IOBase_close_impl(self);
61}
62
63PyDoc_STRVAR(_io__IOBase_seekable__doc__,
64"seekable($self, /)\n"
65"--\n"
66"\n"
67"Return whether object supports random access.\n"
68"\n"
69"If False, seek(), tell() and truncate() will raise OSError.\n"
70"This method may need to do a test seek().");
71
72#define _IO__IOBASE_SEEKABLE_METHODDEF \
73 {"seekable", (PyCFunction)_io__IOBase_seekable, METH_NOARGS, _io__IOBase_seekable__doc__},
74
75static PyObject *
76_io__IOBase_seekable_impl(PyObject *self);
77
78static PyObject *
79_io__IOBase_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
80{
81 return _io__IOBase_seekable_impl(self);
82}
83
84PyDoc_STRVAR(_io__IOBase_readable__doc__,
85"readable($self, /)\n"
86"--\n"
87"\n"
88"Return whether object was opened for reading.\n"
89"\n"
90"If False, read() will raise OSError.");
91
92#define _IO__IOBASE_READABLE_METHODDEF \
93 {"readable", (PyCFunction)_io__IOBase_readable, METH_NOARGS, _io__IOBase_readable__doc__},
94
95static PyObject *
96_io__IOBase_readable_impl(PyObject *self);
97
98static PyObject *
99_io__IOBase_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
100{
101 return _io__IOBase_readable_impl(self);
102}
103
104PyDoc_STRVAR(_io__IOBase_writable__doc__,
105"writable($self, /)\n"
106"--\n"
107"\n"
108"Return whether object was opened for writing.\n"
109"\n"
110"If False, write() will raise OSError.");
111
112#define _IO__IOBASE_WRITABLE_METHODDEF \
113 {"writable", (PyCFunction)_io__IOBase_writable, METH_NOARGS, _io__IOBase_writable__doc__},
114
115static PyObject *
116_io__IOBase_writable_impl(PyObject *self);
117
118static PyObject *
119_io__IOBase_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
120{
121 return _io__IOBase_writable_impl(self);
122}
123
124PyDoc_STRVAR(_io__IOBase_fileno__doc__,
125"fileno($self, /)\n"
126"--\n"
127"\n"
128"Returns underlying file descriptor if one exists.\n"
129"\n"
130"OSError is raised if the IO object does not use a file descriptor.");
131
132#define _IO__IOBASE_FILENO_METHODDEF \
133 {"fileno", (PyCFunction)_io__IOBase_fileno, METH_NOARGS, _io__IOBase_fileno__doc__},
134
135static PyObject *
136_io__IOBase_fileno_impl(PyObject *self);
137
138static PyObject *
139_io__IOBase_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
140{
141 return _io__IOBase_fileno_impl(self);
142}
143
144PyDoc_STRVAR(_io__IOBase_isatty__doc__,
145"isatty($self, /)\n"
146"--\n"
147"\n"
148"Return whether this is an \'interactive\' stream.\n"
149"\n"
150"Return False if it can\'t be determined.");
151
152#define _IO__IOBASE_ISATTY_METHODDEF \
153 {"isatty", (PyCFunction)_io__IOBase_isatty, METH_NOARGS, _io__IOBase_isatty__doc__},
154
155static PyObject *
156_io__IOBase_isatty_impl(PyObject *self);
157
158static PyObject *
159_io__IOBase_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
160{
161 return _io__IOBase_isatty_impl(self);
162}
163
164PyDoc_STRVAR(_io__IOBase_readline__doc__,
165"readline($self, size=-1, /)\n"
166"--\n"
167"\n"
168"Read and return a line from the stream.\n"
169"\n"
170"If size is specified, at most size bytes will be read.\n"
171"\n"
172"The line terminator is always b\'\\n\' for binary files; for text\n"
173"files, the newlines argument to open can be used to select the line\n"
174"terminator(s) recognized.");
175
176#define _IO__IOBASE_READLINE_METHODDEF \
177 {"readline", (PyCFunction)(void(*)(void))_io__IOBase_readline, METH_FASTCALL, _io__IOBase_readline__doc__},
178
179static PyObject *
180_io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
181
182static PyObject *
183_io__IOBase_readline(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
184{
185 PyObject *return_value = NULL;
186 Py_ssize_t limit = -1;
187
188 if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
189 goto exit;
190 }
191 if (nargs < 1) {
192 goto skip_optional;
193 }
194 if (!_Py_convert_optional_to_ssize_t(args[0], &limit)) {
195 goto exit;
196 }
197skip_optional:
198 return_value = _io__IOBase_readline_impl(self, limit);
199
200exit:
201 return return_value;
202}
203
204PyDoc_STRVAR(_io__IOBase_readlines__doc__,
205"readlines($self, hint=-1, /)\n"
206"--\n"
207"\n"
208"Return a list of lines from the stream.\n"
209"\n"
210"hint can be specified to control the number of lines read: no more\n"
211"lines will be read if the total size (in bytes/characters) of all\n"
212"lines so far exceeds hint.");
213
214#define _IO__IOBASE_READLINES_METHODDEF \
215 {"readlines", (PyCFunction)(void(*)(void))_io__IOBase_readlines, METH_FASTCALL, _io__IOBase_readlines__doc__},
216
217static PyObject *
218_io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
219
220static PyObject *
221_io__IOBase_readlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
222{
223 PyObject *return_value = NULL;
224 Py_ssize_t hint = -1;
225
226 if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
227 goto exit;
228 }
229 if (nargs < 1) {
230 goto skip_optional;
231 }
232 if (!_Py_convert_optional_to_ssize_t(args[0], &hint)) {
233 goto exit;
234 }
235skip_optional:
236 return_value = _io__IOBase_readlines_impl(self, hint);
237
238exit:
239 return return_value;
240}
241
242PyDoc_STRVAR(_io__IOBase_writelines__doc__,
243"writelines($self, lines, /)\n"
244"--\n"
245"\n"
246"Write a list of lines to stream.\n"
247"\n"
248"Line separators are not added, so it is usual for each of the\n"
249"lines provided to have a line separator at the end.");
250
251#define _IO__IOBASE_WRITELINES_METHODDEF \
252 {"writelines", (PyCFunction)_io__IOBase_writelines, METH_O, _io__IOBase_writelines__doc__},
253
254PyDoc_STRVAR(_io__RawIOBase_read__doc__,
255"read($self, size=-1, /)\n"
256"--\n"
257"\n");
258
259#define _IO__RAWIOBASE_READ_METHODDEF \
260 {"read", (PyCFunction)(void(*)(void))_io__RawIOBase_read, METH_FASTCALL, _io__RawIOBase_read__doc__},
261
262static PyObject *
263_io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
264
265static PyObject *
266_io__RawIOBase_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
267{
268 PyObject *return_value = NULL;
269 Py_ssize_t n = -1;
270
271 if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
272 goto exit;
273 }
274 if (nargs < 1) {
275 goto skip_optional;
276 }
277 {
278 Py_ssize_t ival = -1;
279 PyObject *iobj = _PyNumber_Index(args[0]);
280 if (iobj != NULL) {
281 ival = PyLong_AsSsize_t(iobj);
282 Py_DECREF(iobj);
283 }
284 if (ival == -1 && PyErr_Occurred()) {
285 goto exit;
286 }
287 n = ival;
288 }
289skip_optional:
290 return_value = _io__RawIOBase_read_impl(self, n);
291
292exit:
293 return return_value;
294}
295
296PyDoc_STRVAR(_io__RawIOBase_readall__doc__,
297"readall($self, /)\n"
298"--\n"
299"\n"
300"Read until EOF, using multiple read() call.");
301
302#define _IO__RAWIOBASE_READALL_METHODDEF \
303 {"readall", (PyCFunction)_io__RawIOBase_readall, METH_NOARGS, _io__RawIOBase_readall__doc__},
304
305static PyObject *
306_io__RawIOBase_readall_impl(PyObject *self);
307
308static PyObject *
309_io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
310{
311 return _io__RawIOBase_readall_impl(self);
312}
313/*[clinic end generated code: output=83c1361a7a51ca84 input=a9049054013a1b77]*/
314