1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_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
14 static PyObject *
15 _io__IOBase_tell_impl(PyObject *self);
16
17 static PyObject *
_io__IOBase_tell(PyObject * self,PyObject * Py_UNUSED (ignored))18 _io__IOBase_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
19 {
20 return _io__IOBase_tell_impl(self);
21 }
22
23 PyDoc_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
34 static PyObject *
35 _io__IOBase_flush_impl(PyObject *self);
36
37 static PyObject *
_io__IOBase_flush(PyObject * self,PyObject * Py_UNUSED (ignored))38 _io__IOBase_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
39 {
40 return _io__IOBase_flush_impl(self);
41 }
42
43 PyDoc_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
54 static PyObject *
55 _io__IOBase_close_impl(PyObject *self);
56
57 static PyObject *
_io__IOBase_close(PyObject * self,PyObject * Py_UNUSED (ignored))58 _io__IOBase_close(PyObject *self, PyObject *Py_UNUSED(ignored))
59 {
60 return _io__IOBase_close_impl(self);
61 }
62
63 PyDoc_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
75 static PyObject *
76 _io__IOBase_seekable_impl(PyObject *self);
77
78 static PyObject *
_io__IOBase_seekable(PyObject * self,PyObject * Py_UNUSED (ignored))79 _io__IOBase_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
80 {
81 return _io__IOBase_seekable_impl(self);
82 }
83
84 PyDoc_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
95 static PyObject *
96 _io__IOBase_readable_impl(PyObject *self);
97
98 static PyObject *
_io__IOBase_readable(PyObject * self,PyObject * Py_UNUSED (ignored))99 _io__IOBase_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
100 {
101 return _io__IOBase_readable_impl(self);
102 }
103
104 PyDoc_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
115 static PyObject *
116 _io__IOBase_writable_impl(PyObject *self);
117
118 static PyObject *
_io__IOBase_writable(PyObject * self,PyObject * Py_UNUSED (ignored))119 _io__IOBase_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
120 {
121 return _io__IOBase_writable_impl(self);
122 }
123
124 PyDoc_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
135 static PyObject *
136 _io__IOBase_fileno_impl(PyObject *self);
137
138 static PyObject *
_io__IOBase_fileno(PyObject * self,PyObject * Py_UNUSED (ignored))139 _io__IOBase_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
140 {
141 return _io__IOBase_fileno_impl(self);
142 }
143
144 PyDoc_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
155 static PyObject *
156 _io__IOBase_isatty_impl(PyObject *self);
157
158 static PyObject *
_io__IOBase_isatty(PyObject * self,PyObject * Py_UNUSED (ignored))159 _io__IOBase_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
160 {
161 return _io__IOBase_isatty_impl(self);
162 }
163
164 PyDoc_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
179 static PyObject *
180 _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit);
181
182 static PyObject *
_io__IOBase_readline(PyObject * self,PyObject * const * args,Py_ssize_t nargs)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 }
197 skip_optional:
198 return_value = _io__IOBase_readline_impl(self, limit);
199
200 exit:
201 return return_value;
202 }
203
204 PyDoc_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
217 static PyObject *
218 _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint);
219
220 static PyObject *
_io__IOBase_readlines(PyObject * self,PyObject * const * args,Py_ssize_t nargs)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 }
235 skip_optional:
236 return_value = _io__IOBase_readlines_impl(self, hint);
237
238 exit:
239 return return_value;
240 }
241
242 PyDoc_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
254 PyDoc_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
262 static PyObject *
263 _io__RawIOBase_read_impl(PyObject *self, Py_ssize_t n);
264
265 static PyObject *
_io__RawIOBase_read(PyObject * self,PyObject * const * args,Py_ssize_t nargs)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 if (PyFloat_Check(args[0])) {
278 PyErr_SetString(PyExc_TypeError,
279 "integer argument expected, got float" );
280 goto exit;
281 }
282 {
283 Py_ssize_t ival = -1;
284 PyObject *iobj = PyNumber_Index(args[0]);
285 if (iobj != NULL) {
286 ival = PyLong_AsSsize_t(iobj);
287 Py_DECREF(iobj);
288 }
289 if (ival == -1 && PyErr_Occurred()) {
290 goto exit;
291 }
292 n = ival;
293 }
294 skip_optional:
295 return_value = _io__RawIOBase_read_impl(self, n);
296
297 exit:
298 return return_value;
299 }
300
301 PyDoc_STRVAR(_io__RawIOBase_readall__doc__,
302 "readall($self, /)\n"
303 "--\n"
304 "\n"
305 "Read until EOF, using multiple read() call.");
306
307 #define _IO__RAWIOBASE_READALL_METHODDEF \
308 {"readall", (PyCFunction)_io__RawIOBase_readall, METH_NOARGS, _io__RawIOBase_readall__doc__},
309
310 static PyObject *
311 _io__RawIOBase_readall_impl(PyObject *self);
312
313 static PyObject *
_io__RawIOBase_readall(PyObject * self,PyObject * Py_UNUSED (ignored))314 _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
315 {
316 return _io__RawIOBase_readall_impl(self);
317 }
318 /*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
319