Coverage Report

Created: 2026-05-30 06:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Modules/_io/clinic/fileio.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6
#  include "pycore_gc.h"          // PyGC_Head
7
#  include "pycore_runtime.h"     // _Py_ID()
8
#endif
9
#include "pycore_abstract.h"      // _Py_convert_optional_to_ssize_t()
10
#include "pycore_modsupport.h"    // _PyArg_UnpackKeywords()
11
12
PyDoc_STRVAR(_io_FileIO_close__doc__,
13
"close($self, /)\n"
14
"--\n"
15
"\n"
16
"Close the file.\n"
17
"\n"
18
"A closed file cannot be used for further I/O operations.  close()\n"
19
"may be called more than once without error.");
20
21
#define _IO_FILEIO_CLOSE_METHODDEF    \
22
    {"close", _PyCFunction_CAST(_io_FileIO_close), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_close__doc__},
23
24
static PyObject *
25
_io_FileIO_close_impl(fileio *self, PyTypeObject *cls);
26
27
static PyObject *
28
_io_FileIO_close(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
29
27.7k
{
30
27.7k
    if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
31
0
        PyErr_SetString(PyExc_TypeError, "close() takes no arguments");
32
0
        return NULL;
33
0
    }
34
27.7k
    return _io_FileIO_close_impl((fileio *)self, cls);
35
27.7k
}
36
37
PyDoc_STRVAR(_io_FileIO___init____doc__,
38
"FileIO(file, mode=\'r\', closefd=True, opener=None)\n"
39
"--\n"
40
"\n"
41
"Open a file.\n"
42
"\n"
43
"The mode can be \'r\' (default), \'w\', \'x\' or \'a\' for reading,\n"
44
"writing, exclusive creation or appending.  The file will be created\n"
45
"if it doesn\'t exist when opened for writing or appending; it will be\n"
46
"truncated when opened for writing.  A FileExistsError will be raised\n"
47
"if it already exists when opened for creating.  Opening a file for\n"
48
"creating implies writing so this mode behaves in a similar way to\n"
49
"\'w\'.  Add a \'+\' to the mode to allow simultaneous reading and\n"
50
"writing.\n"
51
"\n"
52
"A custom opener can be used by passing a callable as *opener*.\n"
53
"The underlying file descriptor for the file object is then obtained\n"
54
"by calling opener with (*name*, *flags*).  *opener* must return\n"
55
"an open file descriptor (passing os.open as *opener* results in\n"
56
"functionality similar to passing None).");
57
58
static int
59
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
60
                         int closefd, PyObject *opener);
61
62
static int
63
_io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
64
27.8k
{
65
27.8k
    int return_value = -1;
66
27.8k
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
67
68
27.8k
    #define NUM_KEYWORDS 4
69
27.8k
    static struct {
70
27.8k
        PyGC_Head _this_is_not_used;
71
27.8k
        PyObject_VAR_HEAD
72
27.8k
        Py_hash_t ob_hash;
73
27.8k
        PyObject *ob_item[NUM_KEYWORDS];
74
27.8k
    } _kwtuple = {
75
27.8k
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
76
27.8k
        .ob_hash = -1,
77
27.8k
        .ob_item = { &_Py_ID(file), &_Py_ID(mode), &_Py_ID(closefd), &_Py_ID(opener), },
78
27.8k
    };
79
27.8k
    #undef NUM_KEYWORDS
80
27.8k
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
81
82
    #else  // !Py_BUILD_CORE
83
    #  define KWTUPLE NULL
84
    #endif  // !Py_BUILD_CORE
85
86
27.8k
    static const char * const _keywords[] = {"file", "mode", "closefd", "opener", NULL};
87
27.8k
    static _PyArg_Parser _parser = {
88
27.8k
        .keywords = _keywords,
89
27.8k
        .fname = "FileIO",
90
27.8k
        .kwtuple = KWTUPLE,
91
27.8k
    };
92
27.8k
    #undef KWTUPLE
93
27.8k
    PyObject *argsbuf[4];
94
27.8k
    PyObject * const *fastargs;
95
27.8k
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
96
27.8k
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
97
27.8k
    PyObject *nameobj;
98
27.8k
    const char *mode = "r";
99
27.8k
    int closefd = 1;
100
27.8k
    PyObject *opener = Py_None;
101
102
27.8k
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser,
103
27.8k
            /*minpos*/ 1, /*maxpos*/ 4, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
104
27.8k
    if (!fastargs) {
105
0
        goto exit;
106
0
    }
107
27.8k
    nameobj = fastargs[0];
108
27.8k
    if (!noptargs) {
109
0
        goto skip_optional_pos;
110
0
    }
111
27.8k
    if (fastargs[1]) {
112
27.8k
        if (!PyUnicode_Check(fastargs[1])) {
113
0
            _PyArg_BadArgument("FileIO", "argument 'mode'", "str", fastargs[1]);
114
0
            goto exit;
115
0
        }
116
27.8k
        Py_ssize_t mode_length;
117
27.8k
        mode = PyUnicode_AsUTF8AndSize(fastargs[1], &mode_length);
118
27.8k
        if (mode == NULL) {
119
0
            goto exit;
120
0
        }
121
27.8k
        if (strlen(mode) != (size_t)mode_length) {
122
0
            PyErr_SetString(PyExc_ValueError, "embedded null character");
123
0
            goto exit;
124
0
        }
125
27.8k
        if (!--noptargs) {
126
0
            goto skip_optional_pos;
127
0
        }
128
27.8k
    }
129
27.8k
    if (fastargs[2]) {
130
27.8k
        closefd = PyObject_IsTrue(fastargs[2]);
131
27.8k
        if (closefd < 0) {
132
0
            goto exit;
133
0
        }
134
27.8k
        if (!--noptargs) {
135
0
            goto skip_optional_pos;
136
0
        }
137
27.8k
    }
138
27.8k
    opener = fastargs[3];
139
27.8k
skip_optional_pos:
140
27.8k
    return_value = _io_FileIO___init___impl((fileio *)self, nameobj, mode, closefd, opener);
141
142
27.8k
exit:
143
27.8k
    return return_value;
144
27.8k
}
145
146
PyDoc_STRVAR(_io_FileIO_fileno__doc__,
147
"fileno($self, /)\n"
148
"--\n"
149
"\n"
150
"Return the underlying file descriptor (an integer).");
151
152
#define _IO_FILEIO_FILENO_METHODDEF    \
153
    {"fileno", (PyCFunction)_io_FileIO_fileno, METH_NOARGS, _io_FileIO_fileno__doc__},
154
155
static PyObject *
156
_io_FileIO_fileno_impl(fileio *self);
157
158
static PyObject *
159
_io_FileIO_fileno(PyObject *self, PyObject *Py_UNUSED(ignored))
160
0
{
161
0
    return _io_FileIO_fileno_impl((fileio *)self);
162
0
}
163
164
PyDoc_STRVAR(_io_FileIO_readable__doc__,
165
"readable($self, /)\n"
166
"--\n"
167
"\n"
168
"True if file was opened in a read mode.");
169
170
#define _IO_FILEIO_READABLE_METHODDEF    \
171
    {"readable", (PyCFunction)_io_FileIO_readable, METH_NOARGS, _io_FileIO_readable__doc__},
172
173
static PyObject *
174
_io_FileIO_readable_impl(fileio *self);
175
176
static PyObject *
177
_io_FileIO_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
178
6.64k
{
179
6.64k
    return _io_FileIO_readable_impl((fileio *)self);
180
6.64k
}
181
182
PyDoc_STRVAR(_io_FileIO_writable__doc__,
183
"writable($self, /)\n"
184
"--\n"
185
"\n"
186
"True if file was opened in a write mode.");
187
188
#define _IO_FILEIO_WRITABLE_METHODDEF    \
189
    {"writable", (PyCFunction)_io_FileIO_writable, METH_NOARGS, _io_FileIO_writable__doc__},
190
191
static PyObject *
192
_io_FileIO_writable_impl(fileio *self);
193
194
static PyObject *
195
_io_FileIO_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
196
21.3k
{
197
21.3k
    return _io_FileIO_writable_impl((fileio *)self);
198
21.3k
}
199
200
PyDoc_STRVAR(_io_FileIO_seekable__doc__,
201
"seekable($self, /)\n"
202
"--\n"
203
"\n"
204
"True if file supports random-access.");
205
206
#define _IO_FILEIO_SEEKABLE_METHODDEF    \
207
    {"seekable", (PyCFunction)_io_FileIO_seekable, METH_NOARGS, _io_FileIO_seekable__doc__},
208
209
static PyObject *
210
_io_FileIO_seekable_impl(fileio *self);
211
212
static PyObject *
213
_io_FileIO_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
214
140
{
215
140
    return _io_FileIO_seekable_impl((fileio *)self);
216
140
}
217
218
PyDoc_STRVAR(_io_FileIO_readinto__doc__,
219
"readinto($self, buffer, /)\n"
220
"--\n"
221
"\n"
222
"Same as RawIOBase.readinto().");
223
224
#define _IO_FILEIO_READINTO_METHODDEF    \
225
    {"readinto", _PyCFunction_CAST(_io_FileIO_readinto), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_readinto__doc__},
226
227
static PyObject *
228
_io_FileIO_readinto_impl(fileio *self, PyTypeObject *cls, Py_buffer *buffer);
229
230
static PyObject *
231
_io_FileIO_readinto(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
232
44
{
233
44
    PyObject *return_value = NULL;
234
44
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
235
44
    #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
236
    #else
237
    #  define KWTUPLE NULL
238
    #endif
239
240
44
    static const char * const _keywords[] = {"", NULL};
241
44
    static _PyArg_Parser _parser = {
242
44
        .keywords = _keywords,
243
44
        .fname = "readinto",
244
44
        .kwtuple = KWTUPLE,
245
44
    };
246
44
    #undef KWTUPLE
247
44
    PyObject *argsbuf[1];
248
44
    Py_buffer buffer = {NULL, NULL};
249
250
44
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
251
44
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
252
44
    if (!args) {
253
0
        goto exit;
254
0
    }
255
44
    if (PyObject_GetBuffer(args[0], &buffer, PyBUF_WRITABLE) < 0) {
256
0
        _PyArg_BadArgument("readinto", "argument 1", "read-write bytes-like object", args[0]);
257
0
        goto exit;
258
0
    }
259
44
    return_value = _io_FileIO_readinto_impl((fileio *)self, cls, &buffer);
260
261
44
exit:
262
    /* Cleanup for buffer */
263
44
    if (buffer.obj) {
264
44
       PyBuffer_Release(&buffer);
265
44
    }
266
267
44
    return return_value;
268
44
}
269
270
PyDoc_STRVAR(_io_FileIO_readall__doc__,
271
"readall($self, /)\n"
272
"--\n"
273
"\n"
274
"Read all data from the file, returned as bytes.\n"
275
"\n"
276
"Reads until either there is an error or read() returns size 0\n"
277
"(indicates EOF).  If the file is already at EOF, returns an empty\n"
278
"bytes object.\n"
279
"\n"
280
"In non-blocking mode, returns as much data as could be read before\n"
281
"EAGAIN.  If no data is available (EAGAIN is returned before bytes\n"
282
"are read) returns None.");
283
284
#define _IO_FILEIO_READALL_METHODDEF    \
285
    {"readall", _PyCFunction_CAST(_io_FileIO_readall), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_readall__doc__},
286
287
static PyObject *
288
_io_FileIO_readall_impl(fileio *self, PyTypeObject *cls);
289
290
static PyObject *
291
_io_FileIO_readall(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
292
6.53k
{
293
6.53k
    if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
294
0
        PyErr_SetString(PyExc_TypeError, "readall() takes no arguments");
295
0
        return NULL;
296
0
    }
297
6.53k
    return _io_FileIO_readall_impl((fileio *)self, cls);
298
6.53k
}
299
300
PyDoc_STRVAR(_io_FileIO_read__doc__,
301
"read($self, size=-1, /)\n"
302
"--\n"
303
"\n"
304
"Read at most size bytes, returned as bytes.\n"
305
"\n"
306
"If size is less than 0, read all bytes in the file making multiple\n"
307
"read calls.  See ``FileIO.readall``.\n"
308
"\n"
309
"Attempts to make only one system call, retrying only per PEP 475\n"
310
"(EINTR).  This means less data may be returned than requested.\n"
311
"\n"
312
"In non-blocking mode, returns None if no data is available.  Return\n"
313
"an empty bytes object at EOF.");
314
315
#define _IO_FILEIO_READ_METHODDEF    \
316
    {"read", _PyCFunction_CAST(_io_FileIO_read), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_read__doc__},
317
318
static PyObject *
319
_io_FileIO_read_impl(fileio *self, PyTypeObject *cls, Py_ssize_t size);
320
321
static PyObject *
322
_io_FileIO_read(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
323
0
{
324
0
    PyObject *return_value = NULL;
325
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
326
0
    #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
327
    #else
328
    #  define KWTUPLE NULL
329
    #endif
330
331
0
    static const char * const _keywords[] = {"", NULL};
332
0
    static _PyArg_Parser _parser = {
333
0
        .keywords = _keywords,
334
0
        .fname = "read",
335
0
        .kwtuple = KWTUPLE,
336
0
    };
337
0
    #undef KWTUPLE
338
0
    PyObject *argsbuf[1];
339
0
    Py_ssize_t size = -1;
340
341
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
342
0
            /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
343
0
    if (!args) {
344
0
        goto exit;
345
0
    }
346
0
    if (nargs < 1) {
347
0
        goto skip_optional_posonly;
348
0
    }
349
0
    if (!_Py_convert_optional_to_ssize_t(args[0], &size)) {
350
0
        goto exit;
351
0
    }
352
0
skip_optional_posonly:
353
0
    return_value = _io_FileIO_read_impl((fileio *)self, cls, size);
354
355
0
exit:
356
0
    return return_value;
357
0
}
358
359
PyDoc_STRVAR(_io_FileIO_write__doc__,
360
"write($self, b, /)\n"
361
"--\n"
362
"\n"
363
"Write buffer b to file, return number of bytes written.\n"
364
"\n"
365
"Only makes one system call, so not all of the data may be written.\n"
366
"The number of bytes actually written is returned.  In non-blocking\n"
367
"mode, returns None if the write would block.");
368
369
#define _IO_FILEIO_WRITE_METHODDEF    \
370
    {"write", _PyCFunction_CAST(_io_FileIO_write), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_write__doc__},
371
372
static PyObject *
373
_io_FileIO_write_impl(fileio *self, PyTypeObject *cls, Py_buffer *b);
374
375
static PyObject *
376
_io_FileIO_write(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
377
281k
{
378
281k
    PyObject *return_value = NULL;
379
281k
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
380
281k
    #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
381
    #else
382
    #  define KWTUPLE NULL
383
    #endif
384
385
281k
    static const char * const _keywords[] = {"", NULL};
386
281k
    static _PyArg_Parser _parser = {
387
281k
        .keywords = _keywords,
388
281k
        .fname = "write",
389
281k
        .kwtuple = KWTUPLE,
390
281k
    };
391
281k
    #undef KWTUPLE
392
281k
    PyObject *argsbuf[1];
393
281k
    Py_buffer b = {NULL, NULL};
394
395
281k
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
396
281k
            /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
397
281k
    if (!args) {
398
0
        goto exit;
399
0
    }
400
281k
    if (PyObject_GetBuffer(args[0], &b, PyBUF_SIMPLE) != 0) {
401
0
        goto exit;
402
0
    }
403
281k
    return_value = _io_FileIO_write_impl((fileio *)self, cls, &b);
404
405
281k
exit:
406
    /* Cleanup for b */
407
281k
    if (b.obj) {
408
281k
       PyBuffer_Release(&b);
409
281k
    }
410
411
281k
    return return_value;
412
281k
}
413
414
PyDoc_STRVAR(_io_FileIO_seek__doc__,
415
"seek($self, pos, whence=0, /)\n"
416
"--\n"
417
"\n"
418
"Move to new file position and return the file position.\n"
419
"\n"
420
"Argument offset is a byte count.  Optional argument whence defaults\n"
421
"to SEEK_SET or 0 (offset from start of file, offset should be >= 0);\n"
422
"other values are SEEK_CUR or 1 (move relative to current position,\n"
423
"positive or negative), and SEEK_END or 2 (move relative to end of\n"
424
"file, usually negative, although many platforms allow seeking beyond\n"
425
"the end of a file).\n"
426
"\n"
427
"Note that not all file objects are seekable.");
428
429
#define _IO_FILEIO_SEEK_METHODDEF    \
430
    {"seek", _PyCFunction_CAST(_io_FileIO_seek), METH_FASTCALL, _io_FileIO_seek__doc__},
431
432
static PyObject *
433
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence);
434
435
static PyObject *
436
_io_FileIO_seek(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
437
0
{
438
0
    PyObject *return_value = NULL;
439
0
    PyObject *pos;
440
0
    int whence = 0;
441
442
0
    if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
443
0
        goto exit;
444
0
    }
445
0
    pos = args[0];
446
0
    if (nargs < 2) {
447
0
        goto skip_optional;
448
0
    }
449
0
    whence = PyLong_AsInt(args[1]);
450
0
    if (whence == -1 && PyErr_Occurred()) {
451
0
        goto exit;
452
0
    }
453
0
skip_optional:
454
0
    return_value = _io_FileIO_seek_impl((fileio *)self, pos, whence);
455
456
0
exit:
457
0
    return return_value;
458
0
}
459
460
PyDoc_STRVAR(_io_FileIO_tell__doc__,
461
"tell($self, /)\n"
462
"--\n"
463
"\n"
464
"Current file position.\n"
465
"\n"
466
"Can raise OSError for non seekable files.");
467
468
#define _IO_FILEIO_TELL_METHODDEF    \
469
    {"tell", (PyCFunction)_io_FileIO_tell, METH_NOARGS, _io_FileIO_tell__doc__},
470
471
static PyObject *
472
_io_FileIO_tell_impl(fileio *self);
473
474
static PyObject *
475
_io_FileIO_tell(PyObject *self, PyObject *Py_UNUSED(ignored))
476
27.9k
{
477
27.9k
    return _io_FileIO_tell_impl((fileio *)self);
478
27.9k
}
479
480
#if defined(HAVE_FTRUNCATE)
481
482
PyDoc_STRVAR(_io_FileIO_truncate__doc__,
483
"truncate($self, size=None, /)\n"
484
"--\n"
485
"\n"
486
"Truncate the file to at most size bytes and return the truncated size.\n"
487
"\n"
488
"Size defaults to the current file position, as returned by tell().\n"
489
"The current file position is changed to the value of size.");
490
491
#define _IO_FILEIO_TRUNCATE_METHODDEF    \
492
    {"truncate", _PyCFunction_CAST(_io_FileIO_truncate), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_truncate__doc__},
493
494
static PyObject *
495
_io_FileIO_truncate_impl(fileio *self, PyTypeObject *cls, PyObject *posobj);
496
497
static PyObject *
498
_io_FileIO_truncate(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
499
0
{
500
0
    PyObject *return_value = NULL;
501
0
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
502
0
    #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
503
    #else
504
    #  define KWTUPLE NULL
505
    #endif
506
507
0
    static const char * const _keywords[] = {"", NULL};
508
0
    static _PyArg_Parser _parser = {
509
0
        .keywords = _keywords,
510
0
        .fname = "truncate",
511
0
        .kwtuple = KWTUPLE,
512
0
    };
513
0
    #undef KWTUPLE
514
0
    PyObject *argsbuf[1];
515
0
    PyObject *posobj = Py_None;
516
517
0
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
518
0
            /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
519
0
    if (!args) {
520
0
        goto exit;
521
0
    }
522
0
    if (nargs < 1) {
523
0
        goto skip_optional_posonly;
524
0
    }
525
0
    posobj = args[0];
526
0
skip_optional_posonly:
527
0
    return_value = _io_FileIO_truncate_impl((fileio *)self, cls, posobj);
528
529
0
exit:
530
0
    return return_value;
531
0
}
532
533
#endif /* defined(HAVE_FTRUNCATE) */
534
535
PyDoc_STRVAR(_io_FileIO_isatty__doc__,
536
"isatty($self, /)\n"
537
"--\n"
538
"\n"
539
"True if the file is connected to a TTY device.");
540
541
#define _IO_FILEIO_ISATTY_METHODDEF    \
542
    {"isatty", (PyCFunction)_io_FileIO_isatty, METH_NOARGS, _io_FileIO_isatty__doc__},
543
544
static PyObject *
545
_io_FileIO_isatty_impl(fileio *self);
546
547
static PyObject *
548
_io_FileIO_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
549
111
{
550
111
    return _io_FileIO_isatty_impl((fileio *)self);
551
111
}
552
553
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
554
    #define _IO_FILEIO_TRUNCATE_METHODDEF
555
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
556
/*[clinic end generated code: output=453d584e2e72f986 input=a9049054013a1b77]*/