Debian Codegraph @

Modules/_io/clinic/textio.c.h

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