• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SINGLETON()
8 #endif
9 #include "pycore_abstract.h"      // _Py_convert_optional_to_ssize_t()
10 #include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
11 #include "pycore_modsupport.h"    // _PyArg_UnpackKeywords()
12 
13 PyDoc_STRVAR(_io__TextIOBase_detach__doc__,
14 "detach($self, /)\n"
15 "--\n"
16 "\n"
17 "Separate the underlying buffer from the TextIOBase and return it.\n"
18 "\n"
19 "After the underlying buffer has been detached, the TextIO is in an unusable state.");
20 
21 #define _IO__TEXTIOBASE_DETACH_METHODDEF    \
22     {"detach", _PyCFunction_CAST(_io__TextIOBase_detach), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_detach__doc__},
23 
24 static PyObject *
25 _io__TextIOBase_detach_impl(PyObject *self, PyTypeObject *cls);
26 
27 static PyObject *
_io__TextIOBase_detach(PyObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)28 _io__TextIOBase_detach(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
29 {
30     if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
31         PyErr_SetString(PyExc_TypeError, "detach() takes no arguments");
32         return NULL;
33     }
34     return _io__TextIOBase_detach_impl(self, cls);
35 }
36 
37 PyDoc_STRVAR(_io__TextIOBase_read__doc__,
38 "read($self, size=-1, /)\n"
39 "--\n"
40 "\n"
41 "Read at most size characters from stream.\n"
42 "\n"
43 "Read from underlying buffer until we have size characters or we hit EOF.\n"
44 "If size is negative or omitted, read until EOF.");
45 
46 #define _IO__TEXTIOBASE_READ_METHODDEF    \
47     {"read", _PyCFunction_CAST(_io__TextIOBase_read), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_read__doc__},
48 
49 static PyObject *
50 _io__TextIOBase_read_impl(PyObject *self, PyTypeObject *cls,
51                           int Py_UNUSED(size));
52 
53 static PyObject *
_io__TextIOBase_read(PyObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)54 _io__TextIOBase_read(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
55 {
56     PyObject *return_value = NULL;
57     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
58     #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
59     #else
60     #  define KWTUPLE NULL
61     #endif
62 
63     static const char * const _keywords[] = {"", NULL};
64     static _PyArg_Parser _parser = {
65         .keywords = _keywords,
66         .fname = "read",
67         .kwtuple = KWTUPLE,
68     };
69     #undef KWTUPLE
70     PyObject *argsbuf[1];
71     int size = -1;
72 
73     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
74     if (!args) {
75         goto exit;
76     }
77     if (nargs < 1) {
78         goto skip_optional_posonly;
79     }
80     size = PyLong_AsInt(args[0]);
81     if (size == -1 && PyErr_Occurred()) {
82         goto exit;
83     }
84 skip_optional_posonly:
85     return_value = _io__TextIOBase_read_impl(self, cls, size);
86 
87 exit:
88     return return_value;
89 }
90 
91 PyDoc_STRVAR(_io__TextIOBase_readline__doc__,
92 "readline($self, size=-1, /)\n"
93 "--\n"
94 "\n"
95 "Read until newline or EOF.\n"
96 "\n"
97 "Return an empty string if EOF is hit immediately.\n"
98 "If size is specified, at most size characters will be read.");
99 
100 #define _IO__TEXTIOBASE_READLINE_METHODDEF    \
101     {"readline", _PyCFunction_CAST(_io__TextIOBase_readline), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_readline__doc__},
102 
103 static PyObject *
104 _io__TextIOBase_readline_impl(PyObject *self, PyTypeObject *cls,
105                               int Py_UNUSED(size));
106 
107 static PyObject *
_io__TextIOBase_readline(PyObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)108 _io__TextIOBase_readline(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
109 {
110     PyObject *return_value = NULL;
111     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
112     #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
113     #else
114     #  define KWTUPLE NULL
115     #endif
116 
117     static const char * const _keywords[] = {"", NULL};
118     static _PyArg_Parser _parser = {
119         .keywords = _keywords,
120         .fname = "readline",
121         .kwtuple = KWTUPLE,
122     };
123     #undef KWTUPLE
124     PyObject *argsbuf[1];
125     int size = -1;
126 
127     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
128     if (!args) {
129         goto exit;
130     }
131     if (nargs < 1) {
132         goto skip_optional_posonly;
133     }
134     size = PyLong_AsInt(args[0]);
135     if (size == -1 && PyErr_Occurred()) {
136         goto exit;
137     }
138 skip_optional_posonly:
139     return_value = _io__TextIOBase_readline_impl(self, cls, size);
140 
141 exit:
142     return return_value;
143 }
144 
145 PyDoc_STRVAR(_io__TextIOBase_write__doc__,
146 "write($self, s, /)\n"
147 "--\n"
148 "\n"
149 "Write string s to stream.\n"
150 "\n"
151 "Return the number of characters written\n"
152 "(which is always equal to the length of the string).");
153 
154 #define _IO__TEXTIOBASE_WRITE_METHODDEF    \
155     {"write", _PyCFunction_CAST(_io__TextIOBase_write), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_write__doc__},
156 
157 static PyObject *
158 _io__TextIOBase_write_impl(PyObject *self, PyTypeObject *cls,
159                            const char *Py_UNUSED(s));
160 
161 static PyObject *
_io__TextIOBase_write(PyObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)162 _io__TextIOBase_write(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
163 {
164     PyObject *return_value = NULL;
165     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
166     #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
167     #else
168     #  define KWTUPLE NULL
169     #endif
170 
171     static const char * const _keywords[] = {"", NULL};
172     static _PyArg_Parser _parser = {
173         .keywords = _keywords,
174         .fname = "write",
175         .kwtuple = KWTUPLE,
176     };
177     #undef KWTUPLE
178     PyObject *argsbuf[1];
179     const char *s;
180 
181     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
182     if (!args) {
183         goto exit;
184     }
185     if (!PyUnicode_Check(args[0])) {
186         _PyArg_BadArgument("write", "argument 1", "str", args[0]);
187         goto exit;
188     }
189     Py_ssize_t s_length;
190     s = PyUnicode_AsUTF8AndSize(args[0], &s_length);
191     if (s == NULL) {
192         goto exit;
193     }
194     if (strlen(s) != (size_t)s_length) {
195         PyErr_SetString(PyExc_ValueError, "embedded null character");
196         goto exit;
197     }
198     return_value = _io__TextIOBase_write_impl(self, cls, s);
199 
200 exit:
201     return return_value;
202 }
203 
204 PyDoc_STRVAR(_io__TextIOBase_encoding__doc__,
205 "Encoding of the text stream.\n"
206 "\n"
207 "Subclasses should override.");
208 #define _io__TextIOBase_encoding_DOCSTR _io__TextIOBase_encoding__doc__
209 
210 #if !defined(_io__TextIOBase_encoding_DOCSTR)
211 #  define _io__TextIOBase_encoding_DOCSTR NULL
212 #endif
213 #if defined(_IO__TEXTIOBASE_ENCODING_GETSETDEF)
214 #  undef _IO__TEXTIOBASE_ENCODING_GETSETDEF
215 #  define _IO__TEXTIOBASE_ENCODING_GETSETDEF {"encoding", (getter)_io__TextIOBase_encoding_get, (setter)_io__TextIOBase_encoding_set, _io__TextIOBase_encoding_DOCSTR},
216 #else
217 #  define _IO__TEXTIOBASE_ENCODING_GETSETDEF {"encoding", (getter)_io__TextIOBase_encoding_get, NULL, _io__TextIOBase_encoding_DOCSTR},
218 #endif
219 
220 static PyObject *
221 _io__TextIOBase_encoding_get_impl(PyObject *self);
222 
223 static PyObject *
_io__TextIOBase_encoding_get(PyObject * self,void * Py_UNUSED (context))224 _io__TextIOBase_encoding_get(PyObject *self, void *Py_UNUSED(context))
225 {
226     return _io__TextIOBase_encoding_get_impl(self);
227 }
228 
229 PyDoc_STRVAR(_io__TextIOBase_newlines__doc__,
230 "Line endings translated so far.\n"
231 "\n"
232 "Only line endings translated during reading are considered.\n"
233 "\n"
234 "Subclasses should override.");
235 #define _io__TextIOBase_newlines_DOCSTR _io__TextIOBase_newlines__doc__
236 
237 #if !defined(_io__TextIOBase_newlines_DOCSTR)
238 #  define _io__TextIOBase_newlines_DOCSTR NULL
239 #endif
240 #if defined(_IO__TEXTIOBASE_NEWLINES_GETSETDEF)
241 #  undef _IO__TEXTIOBASE_NEWLINES_GETSETDEF
242 #  define _IO__TEXTIOBASE_NEWLINES_GETSETDEF {"newlines", (getter)_io__TextIOBase_newlines_get, (setter)_io__TextIOBase_newlines_set, _io__TextIOBase_newlines_DOCSTR},
243 #else
244 #  define _IO__TEXTIOBASE_NEWLINES_GETSETDEF {"newlines", (getter)_io__TextIOBase_newlines_get, NULL, _io__TextIOBase_newlines_DOCSTR},
245 #endif
246 
247 static PyObject *
248 _io__TextIOBase_newlines_get_impl(PyObject *self);
249 
250 static PyObject *
_io__TextIOBase_newlines_get(PyObject * self,void * Py_UNUSED (context))251 _io__TextIOBase_newlines_get(PyObject *self, void *Py_UNUSED(context))
252 {
253     return _io__TextIOBase_newlines_get_impl(self);
254 }
255 
256 PyDoc_STRVAR(_io__TextIOBase_errors__doc__,
257 "The error setting of the decoder or encoder.\n"
258 "\n"
259 "Subclasses should override.");
260 #define _io__TextIOBase_errors_DOCSTR _io__TextIOBase_errors__doc__
261 
262 #if !defined(_io__TextIOBase_errors_DOCSTR)
263 #  define _io__TextIOBase_errors_DOCSTR NULL
264 #endif
265 #if defined(_IO__TEXTIOBASE_ERRORS_GETSETDEF)
266 #  undef _IO__TEXTIOBASE_ERRORS_GETSETDEF
267 #  define _IO__TEXTIOBASE_ERRORS_GETSETDEF {"errors", (getter)_io__TextIOBase_errors_get, (setter)_io__TextIOBase_errors_set, _io__TextIOBase_errors_DOCSTR},
268 #else
269 #  define _IO__TEXTIOBASE_ERRORS_GETSETDEF {"errors", (getter)_io__TextIOBase_errors_get, NULL, _io__TextIOBase_errors_DOCSTR},
270 #endif
271 
272 static PyObject *
273 _io__TextIOBase_errors_get_impl(PyObject *self);
274 
275 static PyObject *
_io__TextIOBase_errors_get(PyObject * self,void * Py_UNUSED (context))276 _io__TextIOBase_errors_get(PyObject *self, void *Py_UNUSED(context))
277 {
278     return _io__TextIOBase_errors_get_impl(self);
279 }
280 
281 PyDoc_STRVAR(_io_IncrementalNewlineDecoder___init____doc__,
282 "IncrementalNewlineDecoder(decoder, translate, errors=\'strict\')\n"
283 "--\n"
284 "\n"
285 "Codec used when reading a file in universal newlines mode.\n"
286 "\n"
287 "It wraps another incremental decoder, translating \\r\\n and \\r into \\n.\n"
288 "It also records the types of newlines encountered.  When used with\n"
289 "translate=False, it ensures that the newline sequence is returned in\n"
290 "one piece. When used with decoder=None, it expects unicode strings as\n"
291 "decode input and translates newlines without first invoking an external\n"
292 "decoder.");
293 
294 static int
295 _io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self,
296                                             PyObject *decoder, int translate,
297                                             PyObject *errors);
298 
299 static int
_io_IncrementalNewlineDecoder___init__(PyObject * self,PyObject * args,PyObject * kwargs)300 _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject *kwargs)
301 {
302     int return_value = -1;
303     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
304 
305     #define NUM_KEYWORDS 3
306     static struct {
307         PyGC_Head _this_is_not_used;
308         PyObject_VAR_HEAD
309         PyObject *ob_item[NUM_KEYWORDS];
310     } _kwtuple = {
311         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
312         .ob_item = { &_Py_ID(decoder), &_Py_ID(translate), &_Py_ID(errors), },
313     };
314     #undef NUM_KEYWORDS
315     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
316 
317     #else  // !Py_BUILD_CORE
318     #  define KWTUPLE NULL
319     #endif  // !Py_BUILD_CORE
320 
321     static const char * const _keywords[] = {"decoder", "translate", "errors", NULL};
322     static _PyArg_Parser _parser = {
323         .keywords = _keywords,
324         .fname = "IncrementalNewlineDecoder",
325         .kwtuple = KWTUPLE,
326     };
327     #undef KWTUPLE
328     PyObject *argsbuf[3];
329     PyObject * const *fastargs;
330     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
331     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 2;
332     PyObject *decoder;
333     int translate;
334     PyObject *errors = NULL;
335 
336     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 2, 3, 0, argsbuf);
337     if (!fastargs) {
338         goto exit;
339     }
340     decoder = fastargs[0];
341     translate = PyObject_IsTrue(fastargs[1]);
342     if (translate < 0) {
343         goto exit;
344     }
345     if (!noptargs) {
346         goto skip_optional_pos;
347     }
348     errors = fastargs[2];
349 skip_optional_pos:
350     return_value = _io_IncrementalNewlineDecoder___init___impl((nldecoder_object *)self, decoder, translate, errors);
351 
352 exit:
353     return return_value;
354 }
355 
356 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_decode__doc__,
357 "decode($self, /, input, final=False)\n"
358 "--\n"
359 "\n");
360 
361 #define _IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF    \
362     {"decode", _PyCFunction_CAST(_io_IncrementalNewlineDecoder_decode), METH_FASTCALL|METH_KEYWORDS, _io_IncrementalNewlineDecoder_decode__doc__},
363 
364 static PyObject *
365 _io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
366                                           PyObject *input, int final);
367 
368 static PyObject *
_io_IncrementalNewlineDecoder_decode(nldecoder_object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)369 _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
370 {
371     PyObject *return_value = NULL;
372     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
373 
374     #define NUM_KEYWORDS 2
375     static struct {
376         PyGC_Head _this_is_not_used;
377         PyObject_VAR_HEAD
378         PyObject *ob_item[NUM_KEYWORDS];
379     } _kwtuple = {
380         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
381         .ob_item = { &_Py_ID(input), &_Py_ID(final), },
382     };
383     #undef NUM_KEYWORDS
384     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
385 
386     #else  // !Py_BUILD_CORE
387     #  define KWTUPLE NULL
388     #endif  // !Py_BUILD_CORE
389 
390     static const char * const _keywords[] = {"input", "final", NULL};
391     static _PyArg_Parser _parser = {
392         .keywords = _keywords,
393         .fname = "decode",
394         .kwtuple = KWTUPLE,
395     };
396     #undef KWTUPLE
397     PyObject *argsbuf[2];
398     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
399     PyObject *input;
400     int final = 0;
401 
402     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
403     if (!args) {
404         goto exit;
405     }
406     input = args[0];
407     if (!noptargs) {
408         goto skip_optional_pos;
409     }
410     final = PyObject_IsTrue(args[1]);
411     if (final < 0) {
412         goto exit;
413     }
414 skip_optional_pos:
415     return_value = _io_IncrementalNewlineDecoder_decode_impl(self, input, final);
416 
417 exit:
418     return return_value;
419 }
420 
421 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_getstate__doc__,
422 "getstate($self, /)\n"
423 "--\n"
424 "\n");
425 
426 #define _IO_INCREMENTALNEWLINEDECODER_GETSTATE_METHODDEF    \
427     {"getstate", (PyCFunction)_io_IncrementalNewlineDecoder_getstate, METH_NOARGS, _io_IncrementalNewlineDecoder_getstate__doc__},
428 
429 static PyObject *
430 _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self);
431 
432 static PyObject *
_io_IncrementalNewlineDecoder_getstate(nldecoder_object * self,PyObject * Py_UNUSED (ignored))433 _io_IncrementalNewlineDecoder_getstate(nldecoder_object *self, PyObject *Py_UNUSED(ignored))
434 {
435     return _io_IncrementalNewlineDecoder_getstate_impl(self);
436 }
437 
438 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_setstate__doc__,
439 "setstate($self, state, /)\n"
440 "--\n"
441 "\n");
442 
443 #define _IO_INCREMENTALNEWLINEDECODER_SETSTATE_METHODDEF    \
444     {"setstate", (PyCFunction)_io_IncrementalNewlineDecoder_setstate, METH_O, _io_IncrementalNewlineDecoder_setstate__doc__},
445 
446 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_reset__doc__,
447 "reset($self, /)\n"
448 "--\n"
449 "\n");
450 
451 #define _IO_INCREMENTALNEWLINEDECODER_RESET_METHODDEF    \
452     {"reset", (PyCFunction)_io_IncrementalNewlineDecoder_reset, METH_NOARGS, _io_IncrementalNewlineDecoder_reset__doc__},
453 
454 static PyObject *
455 _io_IncrementalNewlineDecoder_reset_impl(nldecoder_object *self);
456 
457 static PyObject *
_io_IncrementalNewlineDecoder_reset(nldecoder_object * self,PyObject * Py_UNUSED (ignored))458 _io_IncrementalNewlineDecoder_reset(nldecoder_object *self, PyObject *Py_UNUSED(ignored))
459 {
460     return _io_IncrementalNewlineDecoder_reset_impl(self);
461 }
462 
463 PyDoc_STRVAR(_io_TextIOWrapper___init____doc__,
464 "TextIOWrapper(buffer, encoding=None, errors=None, newline=None,\n"
465 "              line_buffering=False, write_through=False)\n"
466 "--\n"
467 "\n"
468 "Character and line based layer over a BufferedIOBase object, buffer.\n"
469 "\n"
470 "encoding gives the name of the encoding that the stream will be\n"
471 "decoded or encoded with. It defaults to locale.getencoding().\n"
472 "\n"
473 "errors determines the strictness of encoding and decoding (see\n"
474 "help(codecs.Codec) or the documentation for codecs.register) and\n"
475 "defaults to \"strict\".\n"
476 "\n"
477 "newline controls how line endings are handled. It can be None, \'\',\n"
478 "\'\\n\', \'\\r\', and \'\\r\\n\'.  It works as follows:\n"
479 "\n"
480 "* On input, if newline is None, universal newlines mode is\n"
481 "  enabled. Lines in the input can end in \'\\n\', \'\\r\', or \'\\r\\n\', and\n"
482 "  these are translated into \'\\n\' before being returned to the\n"
483 "  caller. If it is \'\', universal newline mode is enabled, but line\n"
484 "  endings are returned to the caller untranslated. If it has any of\n"
485 "  the other legal values, input lines are only terminated by the given\n"
486 "  string, and the line ending is returned to the caller untranslated.\n"
487 "\n"
488 "* On output, if newline is None, any \'\\n\' characters written are\n"
489 "  translated to the system default line separator, os.linesep. If\n"
490 "  newline is \'\' or \'\\n\', no translation takes place. If newline is any\n"
491 "  of the other legal values, any \'\\n\' characters written are translated\n"
492 "  to the given string.\n"
493 "\n"
494 "If line_buffering is True, a call to flush is implied when a call to\n"
495 "write contains a newline character.");
496 
497 static int
498 _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
499                                 const char *encoding, PyObject *errors,
500                                 const char *newline, int line_buffering,
501                                 int write_through);
502 
503 static int
_io_TextIOWrapper___init__(PyObject * self,PyObject * args,PyObject * kwargs)504 _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
505 {
506     int return_value = -1;
507     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
508 
509     #define NUM_KEYWORDS 6
510     static struct {
511         PyGC_Head _this_is_not_used;
512         PyObject_VAR_HEAD
513         PyObject *ob_item[NUM_KEYWORDS];
514     } _kwtuple = {
515         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
516         .ob_item = { &_Py_ID(buffer), &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(newline), &_Py_ID(line_buffering), &_Py_ID(write_through), },
517     };
518     #undef NUM_KEYWORDS
519     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
520 
521     #else  // !Py_BUILD_CORE
522     #  define KWTUPLE NULL
523     #endif  // !Py_BUILD_CORE
524 
525     static const char * const _keywords[] = {"buffer", "encoding", "errors", "newline", "line_buffering", "write_through", NULL};
526     static _PyArg_Parser _parser = {
527         .keywords = _keywords,
528         .fname = "TextIOWrapper",
529         .kwtuple = KWTUPLE,
530     };
531     #undef KWTUPLE
532     PyObject *argsbuf[6];
533     PyObject * const *fastargs;
534     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
535     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
536     PyObject *buffer;
537     const char *encoding = NULL;
538     PyObject *errors = Py_None;
539     const char *newline = NULL;
540     int line_buffering = 0;
541     int write_through = 0;
542 
543     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 6, 0, argsbuf);
544     if (!fastargs) {
545         goto exit;
546     }
547     buffer = fastargs[0];
548     if (!noptargs) {
549         goto skip_optional_pos;
550     }
551     if (fastargs[1]) {
552         if (fastargs[1] == Py_None) {
553             encoding = NULL;
554         }
555         else if (PyUnicode_Check(fastargs[1])) {
556             Py_ssize_t encoding_length;
557             encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
558             if (encoding == NULL) {
559                 goto exit;
560             }
561             if (strlen(encoding) != (size_t)encoding_length) {
562                 PyErr_SetString(PyExc_ValueError, "embedded null character");
563                 goto exit;
564             }
565         }
566         else {
567             _PyArg_BadArgument("TextIOWrapper", "argument 'encoding'", "str or None", fastargs[1]);
568             goto exit;
569         }
570         if (!--noptargs) {
571             goto skip_optional_pos;
572         }
573     }
574     if (fastargs[2]) {
575         errors = fastargs[2];
576         if (!--noptargs) {
577             goto skip_optional_pos;
578         }
579     }
580     if (fastargs[3]) {
581         if (fastargs[3] == Py_None) {
582             newline = NULL;
583         }
584         else if (PyUnicode_Check(fastargs[3])) {
585             Py_ssize_t newline_length;
586             newline = PyUnicode_AsUTF8AndSize(fastargs[3], &newline_length);
587             if (newline == NULL) {
588                 goto exit;
589             }
590             if (strlen(newline) != (size_t)newline_length) {
591                 PyErr_SetString(PyExc_ValueError, "embedded null character");
592                 goto exit;
593             }
594         }
595         else {
596             _PyArg_BadArgument("TextIOWrapper", "argument 'newline'", "str or None", fastargs[3]);
597             goto exit;
598         }
599         if (!--noptargs) {
600             goto skip_optional_pos;
601         }
602     }
603     if (fastargs[4]) {
604         line_buffering = PyObject_IsTrue(fastargs[4]);
605         if (line_buffering < 0) {
606             goto exit;
607         }
608         if (!--noptargs) {
609             goto skip_optional_pos;
610         }
611     }
612     write_through = PyObject_IsTrue(fastargs[5]);
613     if (write_through < 0) {
614         goto exit;
615     }
616 skip_optional_pos:
617     return_value = _io_TextIOWrapper___init___impl((textio *)self, buffer, encoding, errors, newline, line_buffering, write_through);
618 
619 exit:
620     return return_value;
621 }
622 
623 PyDoc_STRVAR(_io_TextIOWrapper_reconfigure__doc__,
624 "reconfigure($self, /, *, encoding=None, errors=None, newline=None,\n"
625 "            line_buffering=None, write_through=None)\n"
626 "--\n"
627 "\n"
628 "Reconfigure the text stream with new parameters.\n"
629 "\n"
630 "This also does an implicit stream flush.");
631 
632 #define _IO_TEXTIOWRAPPER_RECONFIGURE_METHODDEF    \
633     {"reconfigure", _PyCFunction_CAST(_io_TextIOWrapper_reconfigure), METH_FASTCALL|METH_KEYWORDS, _io_TextIOWrapper_reconfigure__doc__},
634 
635 static PyObject *
636 _io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
637                                    PyObject *errors, PyObject *newline_obj,
638                                    PyObject *line_buffering_obj,
639                                    PyObject *write_through_obj);
640 
641 static PyObject *
_io_TextIOWrapper_reconfigure(textio * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)642 _io_TextIOWrapper_reconfigure(textio *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
643 {
644     PyObject *return_value = NULL;
645     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
646 
647     #define NUM_KEYWORDS 5
648     static struct {
649         PyGC_Head _this_is_not_used;
650         PyObject_VAR_HEAD
651         PyObject *ob_item[NUM_KEYWORDS];
652     } _kwtuple = {
653         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
654         .ob_item = { &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(newline), &_Py_ID(line_buffering), &_Py_ID(write_through), },
655     };
656     #undef NUM_KEYWORDS
657     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
658 
659     #else  // !Py_BUILD_CORE
660     #  define KWTUPLE NULL
661     #endif  // !Py_BUILD_CORE
662 
663     static const char * const _keywords[] = {"encoding", "errors", "newline", "line_buffering", "write_through", NULL};
664     static _PyArg_Parser _parser = {
665         .keywords = _keywords,
666         .fname = "reconfigure",
667         .kwtuple = KWTUPLE,
668     };
669     #undef KWTUPLE
670     PyObject *argsbuf[5];
671     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
672     PyObject *encoding = Py_None;
673     PyObject *errors = Py_None;
674     PyObject *newline_obj = NULL;
675     PyObject *line_buffering_obj = Py_None;
676     PyObject *write_through_obj = Py_None;
677 
678     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);
679     if (!args) {
680         goto exit;
681     }
682     if (!noptargs) {
683         goto skip_optional_kwonly;
684     }
685     if (args[0]) {
686         encoding = args[0];
687         if (!--noptargs) {
688             goto skip_optional_kwonly;
689         }
690     }
691     if (args[1]) {
692         errors = args[1];
693         if (!--noptargs) {
694             goto skip_optional_kwonly;
695         }
696     }
697     if (args[2]) {
698         newline_obj = args[2];
699         if (!--noptargs) {
700             goto skip_optional_kwonly;
701         }
702     }
703     if (args[3]) {
704         line_buffering_obj = args[3];
705         if (!--noptargs) {
706             goto skip_optional_kwonly;
707         }
708     }
709     write_through_obj = args[4];
710 skip_optional_kwonly:
711     Py_BEGIN_CRITICAL_SECTION(self);
712     return_value = _io_TextIOWrapper_reconfigure_impl(self, encoding, errors, newline_obj, line_buffering_obj, write_through_obj);
713     Py_END_CRITICAL_SECTION();
714 
715 exit:
716     return return_value;
717 }
718 
719 PyDoc_STRVAR(_io_TextIOWrapper_detach__doc__,
720 "detach($self, /)\n"
721 "--\n"
722 "\n");
723 
724 #define _IO_TEXTIOWRAPPER_DETACH_METHODDEF    \
725     {"detach", (PyCFunction)_io_TextIOWrapper_detach, METH_NOARGS, _io_TextIOWrapper_detach__doc__},
726 
727 static PyObject *
728 _io_TextIOWrapper_detach_impl(textio *self);
729 
730 static PyObject *
_io_TextIOWrapper_detach(textio * self,PyObject * Py_UNUSED (ignored))731 _io_TextIOWrapper_detach(textio *self, PyObject *Py_UNUSED(ignored))
732 {
733     PyObject *return_value = NULL;
734 
735     Py_BEGIN_CRITICAL_SECTION(self);
736     return_value = _io_TextIOWrapper_detach_impl(self);
737     Py_END_CRITICAL_SECTION();
738 
739     return return_value;
740 }
741 
742 PyDoc_STRVAR(_io_TextIOWrapper_write__doc__,
743 "write($self, text, /)\n"
744 "--\n"
745 "\n");
746 
747 #define _IO_TEXTIOWRAPPER_WRITE_METHODDEF    \
748     {"write", (PyCFunction)_io_TextIOWrapper_write, METH_O, _io_TextIOWrapper_write__doc__},
749 
750 static PyObject *
751 _io_TextIOWrapper_write_impl(textio *self, PyObject *text);
752 
753 static PyObject *
_io_TextIOWrapper_write(textio * self,PyObject * arg)754 _io_TextIOWrapper_write(textio *self, PyObject *arg)
755 {
756     PyObject *return_value = NULL;
757     PyObject *text;
758 
759     if (!PyUnicode_Check(arg)) {
760         _PyArg_BadArgument("write", "argument", "str", arg);
761         goto exit;
762     }
763     text = arg;
764     Py_BEGIN_CRITICAL_SECTION(self);
765     return_value = _io_TextIOWrapper_write_impl(self, text);
766     Py_END_CRITICAL_SECTION();
767 
768 exit:
769     return return_value;
770 }
771 
772 PyDoc_STRVAR(_io_TextIOWrapper_read__doc__,
773 "read($self, size=-1, /)\n"
774 "--\n"
775 "\n");
776 
777 #define _IO_TEXTIOWRAPPER_READ_METHODDEF    \
778     {"read", _PyCFunction_CAST(_io_TextIOWrapper_read), METH_FASTCALL, _io_TextIOWrapper_read__doc__},
779 
780 static PyObject *
781 _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n);
782 
783 static PyObject *
_io_TextIOWrapper_read(textio * self,PyObject * const * args,Py_ssize_t nargs)784 _io_TextIOWrapper_read(textio *self, PyObject *const *args, Py_ssize_t nargs)
785 {
786     PyObject *return_value = NULL;
787     Py_ssize_t n = -1;
788 
789     if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
790         goto exit;
791     }
792     if (nargs < 1) {
793         goto skip_optional;
794     }
795     if (!_Py_convert_optional_to_ssize_t(args[0], &n)) {
796         goto exit;
797     }
798 skip_optional:
799     Py_BEGIN_CRITICAL_SECTION(self);
800     return_value = _io_TextIOWrapper_read_impl(self, n);
801     Py_END_CRITICAL_SECTION();
802 
803 exit:
804     return return_value;
805 }
806 
807 PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__,
808 "readline($self, size=-1, /)\n"
809 "--\n"
810 "\n");
811 
812 #define _IO_TEXTIOWRAPPER_READLINE_METHODDEF    \
813     {"readline", _PyCFunction_CAST(_io_TextIOWrapper_readline), METH_FASTCALL, _io_TextIOWrapper_readline__doc__},
814 
815 static PyObject *
816 _io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size);
817 
818 static PyObject *
_io_TextIOWrapper_readline(textio * self,PyObject * const * args,Py_ssize_t nargs)819 _io_TextIOWrapper_readline(textio *self, PyObject *const *args, Py_ssize_t nargs)
820 {
821     PyObject *return_value = NULL;
822     Py_ssize_t size = -1;
823 
824     if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
825         goto exit;
826     }
827     if (nargs < 1) {
828         goto skip_optional;
829     }
830     {
831         Py_ssize_t ival = -1;
832         PyObject *iobj = _PyNumber_Index(args[0]);
833         if (iobj != NULL) {
834             ival = PyLong_AsSsize_t(iobj);
835             Py_DECREF(iobj);
836         }
837         if (ival == -1 && PyErr_Occurred()) {
838             goto exit;
839         }
840         size = ival;
841     }
842 skip_optional:
843     Py_BEGIN_CRITICAL_SECTION(self);
844     return_value = _io_TextIOWrapper_readline_impl(self, size);
845     Py_END_CRITICAL_SECTION();
846 
847 exit:
848     return return_value;
849 }
850 
851 PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__,
852 "seek($self, cookie, whence=os.SEEK_SET, /)\n"
853 "--\n"
854 "\n"
855 "Set the stream position, and return the new stream position.\n"
856 "\n"
857 "  cookie\n"
858 "    Zero or an opaque number returned by tell().\n"
859 "  whence\n"
860 "    The relative position to seek from.\n"
861 "\n"
862 "Four operations are supported, given by the following argument\n"
863 "combinations:\n"
864 "\n"
865 "- seek(0, SEEK_SET): Rewind to the start of the stream.\n"
866 "- seek(cookie, SEEK_SET): Restore a previous position;\n"
867 "  \'cookie\' must be a number returned by tell().\n"
868 "- seek(0, SEEK_END): Fast-forward to the end of the stream.\n"
869 "- seek(0, SEEK_CUR): Leave the current stream position unchanged.\n"
870 "\n"
871 "Any other argument combinations are invalid,\n"
872 "and may raise exceptions.");
873 
874 #define _IO_TEXTIOWRAPPER_SEEK_METHODDEF    \
875     {"seek", _PyCFunction_CAST(_io_TextIOWrapper_seek), METH_FASTCALL, _io_TextIOWrapper_seek__doc__},
876 
877 static PyObject *
878 _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence);
879 
880 static PyObject *
_io_TextIOWrapper_seek(textio * self,PyObject * const * args,Py_ssize_t nargs)881 _io_TextIOWrapper_seek(textio *self, PyObject *const *args, Py_ssize_t nargs)
882 {
883     PyObject *return_value = NULL;
884     PyObject *cookieObj;
885     int whence = 0;
886 
887     if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
888         goto exit;
889     }
890     cookieObj = args[0];
891     if (nargs < 2) {
892         goto skip_optional;
893     }
894     whence = PyLong_AsInt(args[1]);
895     if (whence == -1 && PyErr_Occurred()) {
896         goto exit;
897     }
898 skip_optional:
899     Py_BEGIN_CRITICAL_SECTION(self);
900     return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence);
901     Py_END_CRITICAL_SECTION();
902 
903 exit:
904     return return_value;
905 }
906 
907 PyDoc_STRVAR(_io_TextIOWrapper_tell__doc__,
908 "tell($self, /)\n"
909 "--\n"
910 "\n"
911 "Return the stream position as an opaque number.\n"
912 "\n"
913 "The return value of tell() can be given as input to seek(), to restore a\n"
914 "previous stream position.");
915 
916 #define _IO_TEXTIOWRAPPER_TELL_METHODDEF    \
917     {"tell", (PyCFunction)_io_TextIOWrapper_tell, METH_NOARGS, _io_TextIOWrapper_tell__doc__},
918 
919 static PyObject *
920 _io_TextIOWrapper_tell_impl(textio *self);
921 
922 static PyObject *
_io_TextIOWrapper_tell(textio * self,PyObject * Py_UNUSED (ignored))923 _io_TextIOWrapper_tell(textio *self, PyObject *Py_UNUSED(ignored))
924 {
925     PyObject *return_value = NULL;
926 
927     Py_BEGIN_CRITICAL_SECTION(self);
928     return_value = _io_TextIOWrapper_tell_impl(self);
929     Py_END_CRITICAL_SECTION();
930 
931     return return_value;
932 }
933 
934 PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__,
935 "truncate($self, pos=None, /)\n"
936 "--\n"
937 "\n");
938 
939 #define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF    \
940     {"truncate", _PyCFunction_CAST(_io_TextIOWrapper_truncate), METH_FASTCALL, _io_TextIOWrapper_truncate__doc__},
941 
942 static PyObject *
943 _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos);
944 
945 static PyObject *
_io_TextIOWrapper_truncate(textio * self,PyObject * const * args,Py_ssize_t nargs)946 _io_TextIOWrapper_truncate(textio *self, PyObject *const *args, Py_ssize_t nargs)
947 {
948     PyObject *return_value = NULL;
949     PyObject *pos = Py_None;
950 
951     if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) {
952         goto exit;
953     }
954     if (nargs < 1) {
955         goto skip_optional;
956     }
957     pos = args[0];
958 skip_optional:
959     Py_BEGIN_CRITICAL_SECTION(self);
960     return_value = _io_TextIOWrapper_truncate_impl(self, pos);
961     Py_END_CRITICAL_SECTION();
962 
963 exit:
964     return return_value;
965 }
966 
967 PyDoc_STRVAR(_io_TextIOWrapper_fileno__doc__,
968 "fileno($self, /)\n"
969 "--\n"
970 "\n");
971 
972 #define _IO_TEXTIOWRAPPER_FILENO_METHODDEF    \
973     {"fileno", (PyCFunction)_io_TextIOWrapper_fileno, METH_NOARGS, _io_TextIOWrapper_fileno__doc__},
974 
975 static PyObject *
976 _io_TextIOWrapper_fileno_impl(textio *self);
977 
978 static PyObject *
_io_TextIOWrapper_fileno(textio * self,PyObject * Py_UNUSED (ignored))979 _io_TextIOWrapper_fileno(textio *self, PyObject *Py_UNUSED(ignored))
980 {
981     PyObject *return_value = NULL;
982 
983     Py_BEGIN_CRITICAL_SECTION(self);
984     return_value = _io_TextIOWrapper_fileno_impl(self);
985     Py_END_CRITICAL_SECTION();
986 
987     return return_value;
988 }
989 
990 PyDoc_STRVAR(_io_TextIOWrapper_seekable__doc__,
991 "seekable($self, /)\n"
992 "--\n"
993 "\n");
994 
995 #define _IO_TEXTIOWRAPPER_SEEKABLE_METHODDEF    \
996     {"seekable", (PyCFunction)_io_TextIOWrapper_seekable, METH_NOARGS, _io_TextIOWrapper_seekable__doc__},
997 
998 static PyObject *
999 _io_TextIOWrapper_seekable_impl(textio *self);
1000 
1001 static PyObject *
_io_TextIOWrapper_seekable(textio * self,PyObject * Py_UNUSED (ignored))1002 _io_TextIOWrapper_seekable(textio *self, PyObject *Py_UNUSED(ignored))
1003 {
1004     PyObject *return_value = NULL;
1005 
1006     Py_BEGIN_CRITICAL_SECTION(self);
1007     return_value = _io_TextIOWrapper_seekable_impl(self);
1008     Py_END_CRITICAL_SECTION();
1009 
1010     return return_value;
1011 }
1012 
1013 PyDoc_STRVAR(_io_TextIOWrapper_readable__doc__,
1014 "readable($self, /)\n"
1015 "--\n"
1016 "\n");
1017 
1018 #define _IO_TEXTIOWRAPPER_READABLE_METHODDEF    \
1019     {"readable", (PyCFunction)_io_TextIOWrapper_readable, METH_NOARGS, _io_TextIOWrapper_readable__doc__},
1020 
1021 static PyObject *
1022 _io_TextIOWrapper_readable_impl(textio *self);
1023 
1024 static PyObject *
_io_TextIOWrapper_readable(textio * self,PyObject * Py_UNUSED (ignored))1025 _io_TextIOWrapper_readable(textio *self, PyObject *Py_UNUSED(ignored))
1026 {
1027     PyObject *return_value = NULL;
1028 
1029     Py_BEGIN_CRITICAL_SECTION(self);
1030     return_value = _io_TextIOWrapper_readable_impl(self);
1031     Py_END_CRITICAL_SECTION();
1032 
1033     return return_value;
1034 }
1035 
1036 PyDoc_STRVAR(_io_TextIOWrapper_writable__doc__,
1037 "writable($self, /)\n"
1038 "--\n"
1039 "\n");
1040 
1041 #define _IO_TEXTIOWRAPPER_WRITABLE_METHODDEF    \
1042     {"writable", (PyCFunction)_io_TextIOWrapper_writable, METH_NOARGS, _io_TextIOWrapper_writable__doc__},
1043 
1044 static PyObject *
1045 _io_TextIOWrapper_writable_impl(textio *self);
1046 
1047 static PyObject *
_io_TextIOWrapper_writable(textio * self,PyObject * Py_UNUSED (ignored))1048 _io_TextIOWrapper_writable(textio *self, PyObject *Py_UNUSED(ignored))
1049 {
1050     PyObject *return_value = NULL;
1051 
1052     Py_BEGIN_CRITICAL_SECTION(self);
1053     return_value = _io_TextIOWrapper_writable_impl(self);
1054     Py_END_CRITICAL_SECTION();
1055 
1056     return return_value;
1057 }
1058 
1059 PyDoc_STRVAR(_io_TextIOWrapper_isatty__doc__,
1060 "isatty($self, /)\n"
1061 "--\n"
1062 "\n");
1063 
1064 #define _IO_TEXTIOWRAPPER_ISATTY_METHODDEF    \
1065     {"isatty", (PyCFunction)_io_TextIOWrapper_isatty, METH_NOARGS, _io_TextIOWrapper_isatty__doc__},
1066 
1067 static PyObject *
1068 _io_TextIOWrapper_isatty_impl(textio *self);
1069 
1070 static PyObject *
_io_TextIOWrapper_isatty(textio * self,PyObject * Py_UNUSED (ignored))1071 _io_TextIOWrapper_isatty(textio *self, PyObject *Py_UNUSED(ignored))
1072 {
1073     PyObject *return_value = NULL;
1074 
1075     Py_BEGIN_CRITICAL_SECTION(self);
1076     return_value = _io_TextIOWrapper_isatty_impl(self);
1077     Py_END_CRITICAL_SECTION();
1078 
1079     return return_value;
1080 }
1081 
1082 PyDoc_STRVAR(_io_TextIOWrapper_flush__doc__,
1083 "flush($self, /)\n"
1084 "--\n"
1085 "\n");
1086 
1087 #define _IO_TEXTIOWRAPPER_FLUSH_METHODDEF    \
1088     {"flush", (PyCFunction)_io_TextIOWrapper_flush, METH_NOARGS, _io_TextIOWrapper_flush__doc__},
1089 
1090 static PyObject *
1091 _io_TextIOWrapper_flush_impl(textio *self);
1092 
1093 static PyObject *
_io_TextIOWrapper_flush(textio * self,PyObject * Py_UNUSED (ignored))1094 _io_TextIOWrapper_flush(textio *self, PyObject *Py_UNUSED(ignored))
1095 {
1096     PyObject *return_value = NULL;
1097 
1098     Py_BEGIN_CRITICAL_SECTION(self);
1099     return_value = _io_TextIOWrapper_flush_impl(self);
1100     Py_END_CRITICAL_SECTION();
1101 
1102     return return_value;
1103 }
1104 
1105 PyDoc_STRVAR(_io_TextIOWrapper_close__doc__,
1106 "close($self, /)\n"
1107 "--\n"
1108 "\n");
1109 
1110 #define _IO_TEXTIOWRAPPER_CLOSE_METHODDEF    \
1111     {"close", (PyCFunction)_io_TextIOWrapper_close, METH_NOARGS, _io_TextIOWrapper_close__doc__},
1112 
1113 static PyObject *
1114 _io_TextIOWrapper_close_impl(textio *self);
1115 
1116 static PyObject *
_io_TextIOWrapper_close(textio * self,PyObject * Py_UNUSED (ignored))1117 _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
1118 {
1119     PyObject *return_value = NULL;
1120 
1121     Py_BEGIN_CRITICAL_SECTION(self);
1122     return_value = _io_TextIOWrapper_close_impl(self);
1123     Py_END_CRITICAL_SECTION();
1124 
1125     return return_value;
1126 }
1127 
1128 #if !defined(_io_TextIOWrapper_name_DOCSTR)
1129 #  define _io_TextIOWrapper_name_DOCSTR NULL
1130 #endif
1131 #if defined(_IO_TEXTIOWRAPPER_NAME_GETSETDEF)
1132 #  undef _IO_TEXTIOWRAPPER_NAME_GETSETDEF
1133 #  define _IO_TEXTIOWRAPPER_NAME_GETSETDEF {"name", (getter)_io_TextIOWrapper_name_get, (setter)_io_TextIOWrapper_name_set, _io_TextIOWrapper_name_DOCSTR},
1134 #else
1135 #  define _IO_TEXTIOWRAPPER_NAME_GETSETDEF {"name", (getter)_io_TextIOWrapper_name_get, NULL, _io_TextIOWrapper_name_DOCSTR},
1136 #endif
1137 
1138 static PyObject *
1139 _io_TextIOWrapper_name_get_impl(textio *self);
1140 
1141 static PyObject *
_io_TextIOWrapper_name_get(textio * self,void * Py_UNUSED (context))1142 _io_TextIOWrapper_name_get(textio *self, void *Py_UNUSED(context))
1143 {
1144     PyObject *return_value = NULL;
1145 
1146     Py_BEGIN_CRITICAL_SECTION(self);
1147     return_value = _io_TextIOWrapper_name_get_impl(self);
1148     Py_END_CRITICAL_SECTION();
1149 
1150     return return_value;
1151 }
1152 
1153 #if !defined(_io_TextIOWrapper_closed_DOCSTR)
1154 #  define _io_TextIOWrapper_closed_DOCSTR NULL
1155 #endif
1156 #if defined(_IO_TEXTIOWRAPPER_CLOSED_GETSETDEF)
1157 #  undef _IO_TEXTIOWRAPPER_CLOSED_GETSETDEF
1158 #  define _IO_TEXTIOWRAPPER_CLOSED_GETSETDEF {"closed", (getter)_io_TextIOWrapper_closed_get, (setter)_io_TextIOWrapper_closed_set, _io_TextIOWrapper_closed_DOCSTR},
1159 #else
1160 #  define _IO_TEXTIOWRAPPER_CLOSED_GETSETDEF {"closed", (getter)_io_TextIOWrapper_closed_get, NULL, _io_TextIOWrapper_closed_DOCSTR},
1161 #endif
1162 
1163 static PyObject *
1164 _io_TextIOWrapper_closed_get_impl(textio *self);
1165 
1166 static PyObject *
_io_TextIOWrapper_closed_get(textio * self,void * Py_UNUSED (context))1167 _io_TextIOWrapper_closed_get(textio *self, void *Py_UNUSED(context))
1168 {
1169     PyObject *return_value = NULL;
1170 
1171     Py_BEGIN_CRITICAL_SECTION(self);
1172     return_value = _io_TextIOWrapper_closed_get_impl(self);
1173     Py_END_CRITICAL_SECTION();
1174 
1175     return return_value;
1176 }
1177 
1178 #if !defined(_io_TextIOWrapper_newlines_DOCSTR)
1179 #  define _io_TextIOWrapper_newlines_DOCSTR NULL
1180 #endif
1181 #if defined(_IO_TEXTIOWRAPPER_NEWLINES_GETSETDEF)
1182 #  undef _IO_TEXTIOWRAPPER_NEWLINES_GETSETDEF
1183 #  define _IO_TEXTIOWRAPPER_NEWLINES_GETSETDEF {"newlines", (getter)_io_TextIOWrapper_newlines_get, (setter)_io_TextIOWrapper_newlines_set, _io_TextIOWrapper_newlines_DOCSTR},
1184 #else
1185 #  define _IO_TEXTIOWRAPPER_NEWLINES_GETSETDEF {"newlines", (getter)_io_TextIOWrapper_newlines_get, NULL, _io_TextIOWrapper_newlines_DOCSTR},
1186 #endif
1187 
1188 static PyObject *
1189 _io_TextIOWrapper_newlines_get_impl(textio *self);
1190 
1191 static PyObject *
_io_TextIOWrapper_newlines_get(textio * self,void * Py_UNUSED (context))1192 _io_TextIOWrapper_newlines_get(textio *self, void *Py_UNUSED(context))
1193 {
1194     PyObject *return_value = NULL;
1195 
1196     Py_BEGIN_CRITICAL_SECTION(self);
1197     return_value = _io_TextIOWrapper_newlines_get_impl(self);
1198     Py_END_CRITICAL_SECTION();
1199 
1200     return return_value;
1201 }
1202 
1203 #if !defined(_io_TextIOWrapper_errors_DOCSTR)
1204 #  define _io_TextIOWrapper_errors_DOCSTR NULL
1205 #endif
1206 #if defined(_IO_TEXTIOWRAPPER_ERRORS_GETSETDEF)
1207 #  undef _IO_TEXTIOWRAPPER_ERRORS_GETSETDEF
1208 #  define _IO_TEXTIOWRAPPER_ERRORS_GETSETDEF {"errors", (getter)_io_TextIOWrapper_errors_get, (setter)_io_TextIOWrapper_errors_set, _io_TextIOWrapper_errors_DOCSTR},
1209 #else
1210 #  define _IO_TEXTIOWRAPPER_ERRORS_GETSETDEF {"errors", (getter)_io_TextIOWrapper_errors_get, NULL, _io_TextIOWrapper_errors_DOCSTR},
1211 #endif
1212 
1213 static PyObject *
1214 _io_TextIOWrapper_errors_get_impl(textio *self);
1215 
1216 static PyObject *
_io_TextIOWrapper_errors_get(textio * self,void * Py_UNUSED (context))1217 _io_TextIOWrapper_errors_get(textio *self, void *Py_UNUSED(context))
1218 {
1219     PyObject *return_value = NULL;
1220 
1221     Py_BEGIN_CRITICAL_SECTION(self);
1222     return_value = _io_TextIOWrapper_errors_get_impl(self);
1223     Py_END_CRITICAL_SECTION();
1224 
1225     return return_value;
1226 }
1227 
1228 #if !defined(_io_TextIOWrapper__CHUNK_SIZE_DOCSTR)
1229 #  define _io_TextIOWrapper__CHUNK_SIZE_DOCSTR NULL
1230 #endif
1231 #if defined(_IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF)
1232 #  undef _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF
1233 #  define _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF {"_CHUNK_SIZE", (getter)_io_TextIOWrapper__CHUNK_SIZE_get, (setter)_io_TextIOWrapper__CHUNK_SIZE_set, _io_TextIOWrapper__CHUNK_SIZE_DOCSTR},
1234 #else
1235 #  define _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF {"_CHUNK_SIZE", (getter)_io_TextIOWrapper__CHUNK_SIZE_get, NULL, _io_TextIOWrapper__CHUNK_SIZE_DOCSTR},
1236 #endif
1237 
1238 static PyObject *
1239 _io_TextIOWrapper__CHUNK_SIZE_get_impl(textio *self);
1240 
1241 static PyObject *
_io_TextIOWrapper__CHUNK_SIZE_get(textio * self,void * Py_UNUSED (context))1242 _io_TextIOWrapper__CHUNK_SIZE_get(textio *self, void *Py_UNUSED(context))
1243 {
1244     PyObject *return_value = NULL;
1245 
1246     Py_BEGIN_CRITICAL_SECTION(self);
1247     return_value = _io_TextIOWrapper__CHUNK_SIZE_get_impl(self);
1248     Py_END_CRITICAL_SECTION();
1249 
1250     return return_value;
1251 }
1252 
1253 #if !defined(_io_TextIOWrapper__CHUNK_SIZE_DOCSTR)
1254 #  define _io_TextIOWrapper__CHUNK_SIZE_DOCSTR NULL
1255 #endif
1256 #if defined(_IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF)
1257 #  undef _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF
1258 #  define _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF {"_CHUNK_SIZE", (getter)_io_TextIOWrapper__CHUNK_SIZE_get, (setter)_io_TextIOWrapper__CHUNK_SIZE_set, _io_TextIOWrapper__CHUNK_SIZE_DOCSTR},
1259 #else
1260 #  define _IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF {"_CHUNK_SIZE", NULL, (setter)_io_TextIOWrapper__CHUNK_SIZE_set, NULL},
1261 #endif
1262 
1263 static int
1264 _io_TextIOWrapper__CHUNK_SIZE_set_impl(textio *self, PyObject *value);
1265 
1266 static int
_io_TextIOWrapper__CHUNK_SIZE_set(textio * self,PyObject * value,void * Py_UNUSED (context))1267 _io_TextIOWrapper__CHUNK_SIZE_set(textio *self, PyObject *value, void *Py_UNUSED(context))
1268 {
1269     int return_value;
1270 
1271     Py_BEGIN_CRITICAL_SECTION(self);
1272     return_value = _io_TextIOWrapper__CHUNK_SIZE_set_impl(self, value);
1273     Py_END_CRITICAL_SECTION();
1274 
1275     return return_value;
1276 }
1277 /*[clinic end generated code: output=8074cba93ae39cf7 input=a9049054013a1b77]*/
1278