Lines Matching refs:self
53 textiobase_detach(PyObject *self, PyObject *Py_UNUSED(ignored))
66 textiobase_read(PyObject *self, PyObject *args)
78 textiobase_readline(PyObject *self, PyObject *args)
90 textiobase_write(PyObject *self, PyObject *args)
102 textiobase_encoding_get(PyObject *self, void *context)
116 textiobase_newlines_get(PyObject *self, void *context)
128 textiobase_errors_get(PyObject *self, void *context)
229 _io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self,
242 Py_XSETREF(self->errors, errors);
243 Py_XSETREF(self->decoder, Py_NewRef(decoder));
244 self->translate = translate ? 1 : 0;
245 self->seennl = 0;
246 self->pendingcr = 0;
252 incrementalnewlinedecoder_dealloc(nldecoder_object *self)
254 Py_CLEAR(self->decoder);
255 Py_CLEAR(self->errors);
256 Py_TYPE(self)->tp_free((PyObject *)self);
278 #define CHECK_INITIALIZED_DECODER(self) \
279 if (self->errors == NULL) { \
296 nldecoder_object *self = (nldecoder_object *) myself;
298 CHECK_INITIALIZED_DECODER(self);
301 if (self->decoder != Py_None) {
302 output = PyObject_CallMethodObjArgs(self->decoder,
314 if (self->pendingcr && (final || output_len > 0)) {
330 self->pendingcr = 0;
346 self->pendingcr = 1;
355 int seennl = self->seennl;
401 else if (!self->translate) {
477 self->seennl |= seennl;
494 _io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self,
498 return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final);
506 _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self)
512 CHECK_INITIALIZED_DECODER(self);
514 if (self->decoder != Py_None) {
515 PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
539 if (self->pendingcr)
551 _io_IncrementalNewlineDecoder_setstate(nldecoder_object *self,
558 CHECK_INITIALIZED_DECODER(self);
570 self->pendingcr = (int) (flag & 1);
573 if (self->decoder != Py_None) {
574 return _PyObject_CallMethod(self->decoder, &_Py_ID(setstate),
587 _io_IncrementalNewlineDecoder_reset_impl(nldecoder_object *self)
590 CHECK_INITIALIZED_DECODER(self);
592 self->seennl = 0;
593 self->pendingcr = 0;
594 if (self->decoder != Py_None)
595 return PyObject_CallMethodNoArgs(self->decoder, &_Py_ID(reset));
601 incrementalnewlinedecoder_newlines_get(nldecoder_object *self, void *context)
603 CHECK_INITIALIZED_DECODER(self);
605 switch (self->seennl) {
691 textiowrapper_set_decoded_chars(textio *self, PyObject *chars);
697 ascii_encode(textio *self, PyObject *text)
699 return _PyUnicode_AsASCIIString(text, PyUnicode_AsUTF8(self->errors));
703 utf16be_encode(textio *self, PyObject *text)
706 PyUnicode_AsUTF8(self->errors), 1);
710 utf16le_encode(textio *self, PyObject *text)
713 PyUnicode_AsUTF8(self->errors), -1);
717 utf16_encode(textio *self, PyObject *text)
719 if (!self->encoding_start_of_stream) {
722 return utf16be_encode(self, text);
724 return utf16le_encode(self, text);
728 PyUnicode_AsUTF8(self->errors), 0);
732 utf32be_encode(textio *self, PyObject *text)
735 PyUnicode_AsUTF8(self->errors), 1);
739 utf32le_encode(textio *self, PyObject *text)
742 PyUnicode_AsUTF8(self->errors), -1);
746 utf32_encode(textio *self, PyObject *text)
748 if (!self->encoding_start_of_stream) {
751 return utf32be_encode(self, text);
753 return utf32le_encode(self, text);
757 PyUnicode_AsUTF8(self->errors), 0);
761 utf8_encode(textio *self, PyObject *text)
763 return _PyUnicode_AsUTF8String(text, PyUnicode_AsUTF8(self->errors));
767 latin1_encode(textio *self, PyObject *text)
769 return _PyUnicode_AsLatin1String(text, PyUnicode_AsUTF8(self->errors));
816 set_newline(textio *self, const char *newline)
818 PyObject *old = self->readnl;
820 self->readnl = NULL;
823 self->readnl = PyUnicode_FromString(newline);
824 if (self->readnl == NULL) {
825 self->readnl = old;
829 self->readuniversal = (newline == NULL || newline[0] == '\0');
830 self->readtranslate = (newline == NULL);
831 self->writetranslate = (newline == NULL || newline[0] != '\0');
832 if (!self->readuniversal && self->readnl != NULL) {
834 assert(PyUnicode_KIND(self->readnl) == PyUnicode_1BYTE_KIND);
835 self->writenl = (const char *)PyUnicode_1BYTE_DATA(self->readnl);
836 if (strcmp(self->writenl, "\n") == 0) {
837 self->writenl = NULL;
842 self->writenl = "\r\n";
844 self->writenl = NULL;
852 _textiowrapper_set_decoder(textio *self, PyObject *codec_info,
858 res = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(readable));
870 Py_CLEAR(self->decoder);
871 self->decoder = _PyCodecInfo_GetIncrementalDecoder(codec_info, errors);
872 if (self->decoder == NULL)
875 if (self->readuniversal) {
878 self->decoder, self->readtranslate ? Py_True : Py_False, NULL);
881 Py_CLEAR(self->decoder);
882 self->decoder = incrementalDecoder;
907 _textiowrapper_set_encoder(textio *self, PyObject *codec_info,
913 res = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(writable));
925 Py_CLEAR(self->encoder);
926 self->encodefunc = NULL;
927 self->encoder = _PyCodecInfo_GetIncrementalEncoder(codec_info, errors);
928 if (self->encoder == NULL)
939 self->encodefunc = e->encodefunc;
951 _textiowrapper_fix_encoder_state(textio *self)
953 if (!self->seekable || !self->encoder) {
957 self->encoding_start_of_stream = 1;
960 self->buffer, &_Py_ID(tell));
972 self->encoding_start_of_stream = 0;
974 self->encoder, &_Py_ID(setstate), _PyLong_GetZero());
1064 _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
1074 self->ok = 0;
1075 self->detached = 0;
1107 Py_CLEAR(self->buffer);
1108 Py_CLEAR(self->encoding);
1109 Py_CLEAR(self->encoder);
1110 Py_CLEAR(self->decoder);
1111 Py_CLEAR(self->readnl);
1112 Py_CLEAR(self->decoded_chars);
1113 Py_CLEAR(self->pending_bytes);
1114 Py_CLEAR(self->snapshot);
1115 Py_CLEAR(self->errors);
1116 Py_CLEAR(self->raw);
1117 self->decoded_chars_used = 0;
1118 self->pending_bytes_count = 0;
1119 self->encodefunc = NULL;
1120 self->b2cratio = 0.0;
1124 self->encoding = Py_NewRef(&_Py_STR(utf_8));
1127 self->encoding = _Py_GetLocaleEncodingObject();
1128 if (self->encoding == NULL) {
1131 assert(PyUnicode_Check(self->encoding));
1134 if (self->encoding != NULL) {
1135 encoding = PyUnicode_AsUTF8(self->encoding);
1140 self->encoding = PyUnicode_FromString(encoding);
1141 if (self->encoding == NULL)
1153 Py_CLEAR(self->encoding);
1158 * of the partially constructed object (like self->encoding)
1162 self->errors = errors;
1163 self->chunk_size = 8192;
1164 self->line_buffering = line_buffering;
1165 self->write_through = write_through;
1166 if (set_newline(self, newline) < 0) {
1170 self->buffer = buffer;
1174 if (_textiowrapper_set_decoder(self, codec_info, PyUnicode_AsUTF8(errors)) != 0)
1178 if (_textiowrapper_set_encoder(self, codec_info, PyUnicode_AsUTF8(errors)) != 0)
1193 self->raw = raw;
1206 self->seekable = self->telling = r;
1213 self->has_read1 = r;
1215 self->encoding_start_of_stream = 0;
1216 if (_textiowrapper_fix_encoder_state(self) < 0) {
1220 self->ok = 1;
1247 textiowrapper_change_encoding(textio *self, PyObject *encoding,
1256 encoding = self->encoding;
1258 errors = self->errors;
1289 if (_textiowrapper_set_decoder(self, codec_info, c_errors) != 0 ||
1290 _textiowrapper_set_encoder(self, codec_info, c_errors) != 0) {
1298 Py_SETREF(self->encoding, encoding);
1299 Py_SETREF(self->errors, errors);
1301 return _textiowrapper_fix_encoder_state(self);
1320 _io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
1331 if (self->decoded_chars != NULL) {
1347 self->line_buffering);
1349 self->write_through);
1354 PyObject *res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
1359 self->b2cratio = 0;
1361 if (newline_obj != NULL && set_newline(self, newline) < 0) {
1366 self, encoding, errors, newline_obj != NULL) < 0) {
1370 self->line_buffering = line_buffering;
1371 self->write_through = write_through;
1376 textiowrapper_clear(textio *self)
1378 self->ok = 0;
1379 Py_CLEAR(self->buffer);
1380 Py_CLEAR(self->encoding);
1381 Py_CLEAR(self->encoder);
1382 Py_CLEAR(self->decoder);
1383 Py_CLEAR(self->readnl);
1384 Py_CLEAR(self->decoded_chars);
1385 Py_CLEAR(self->pending_bytes);
1386 Py_CLEAR(self->snapshot);
1387 Py_CLEAR(self->errors);
1388 Py_CLEAR(self->raw);
1390 Py_CLEAR(self->dict);
1395 textiowrapper_dealloc(textio *self)
1397 self->finalizing = 1;
1398 if (_PyIOBase_finalize((PyObject *) self) < 0)
1400 self->ok = 0;
1401 _PyObject_GC_UNTRACK(self);
1402 if (self->weakreflist != NULL)
1403 PyObject_ClearWeakRefs((PyObject *)self);
1404 textiowrapper_clear(self);
1405 Py_TYPE(self)->tp_free((PyObject *)self);
1409 textiowrapper_traverse(textio *self, visitproc visit, void *arg)
1411 Py_VISIT(self->buffer);
1412 Py_VISIT(self->encoding);
1413 Py_VISIT(self->encoder);
1414 Py_VISIT(self->decoder);
1415 Py_VISIT(self->readnl);
1416 Py_VISIT(self->decoded_chars);
1417 Py_VISIT(self->pending_bytes);
1418 Py_VISIT(self->snapshot);
1419 Py_VISIT(self->errors);
1420 Py_VISIT(self->raw);
1422 Py_VISIT(self->dict);
1427 textiowrapper_closed_get(textio *self, void *context);
1430 #define CHECK_CLOSED(self) \
1434 if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) { \
1435 if (self->raw != NULL) \
1436 r = _PyFileIO_closed(self->raw); \
1438 _res = textiowrapper_closed_get(self, NULL); \
1452 else if (_PyIOBase_check_closed((PyObject *)self, Py_True) == NULL) \
1456 #define CHECK_INITIALIZED(self) \
1457 if (self->ok <= 0) { \
1463 #define CHECK_ATTACHED(self) \
1464 CHECK_INITIALIZED(self); \
1465 if (self->detached) { \
1471 #define CHECK_ATTACHED_INT(self) \
1472 if (self->ok <= 0) { \
1476 } else if (self->detached) { \
1488 _io_TextIOWrapper_detach_impl(textio *self)
1492 CHECK_ATTACHED(self);
1493 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
1497 buffer = self->buffer;
1498 self->buffer = NULL;
1499 self->detached = 1;
1506 _textiowrapper_writeflush(textio *self)
1508 if (self->pending_bytes == NULL)
1511 PyObject *pending = self->pending_bytes;
1520 assert(PyUnicode_GET_LENGTH(pending) == self->pending_bytes_count);
1529 b = PyBytes_FromStringAndSize(NULL, self->pending_bytes_count);
1556 assert(pos == self->pending_bytes_count);
1559 self->pending_bytes_count = 0;
1560 self->pending_bytes = NULL;
1565 ret = PyObject_CallMethodOneArg(self->buffer, &_Py_ID(write), b);
1583 _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
1595 CHECK_ATTACHED(self);
1596 CHECK_CLOSED(self);
1598 if (self->encoder == NULL)
1605 if ((self->writetranslate && self->writenl != NULL) || self->line_buffering)
1609 if (haslf && self->writetranslate && self->writenl != NULL) {
1611 "ss", "\n", self->writenl);
1618 if (self->write_through)
1620 if (self->line_buffering &&
1626 if (self->encodefunc != NULL) {
1629 PyUnicode_GET_LENGTH(text) <= self->chunk_size &&
1630 is_asciicompat_encoding(self->encodefunc)) {
1635 b = (*self->encodefunc)((PyObject *) self, text);
1637 self->encoding_start_of_stream = 0;
1640 b = PyObject_CallMethodOneArg(self->encoder, &_Py_ID(encode), text);
1662 if (self->pending_bytes == NULL) {
1663 self->pending_bytes_count = 0;
1664 self->pending_bytes = b;
1666 else if (self->pending_bytes_count + bytes_len > self->chunk_size) {
1668 if (_textiowrapper_writeflush(self) < 0) {
1672 self->pending_bytes = b;
1674 else if (!PyList_CheckExact(self->pending_bytes)) {
1680 PyList_SET_ITEM(list, 0, self->pending_bytes);
1682 self->pending_bytes = list;
1685 if (PyList_Append(self->pending_bytes, b) < 0) {
1692 self->pending_bytes_count += bytes_len;
1693 if (self->pending_bytes_count >= self->chunk_size || needflush ||
1695 if (_textiowrapper_writeflush(self) < 0)
1700 ret = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(flush));
1706 textiowrapper_set_decoded_chars(self, NULL);
1707 Py_CLEAR(self->snapshot);
1709 if (self->decoder) {
1710 ret = PyObject_CallMethodNoArgs(self->decoder, &_Py_ID(reset));
1722 textiowrapper_set_decoded_chars(textio *self, PyObject *chars)
1724 Py_XSETREF(self->decoded_chars, chars);
1725 self->decoded_chars_used = 0;
1729 textiowrapper_get_decoded_chars(textio *self, Py_ssize_t n)
1734 if (self->decoded_chars == NULL)
1738 avail = (PyUnicode_GET_LENGTH(self->decoded_chars)
1739 - self->decoded_chars_used);
1746 if (self->decoded_chars_used > 0 || n < avail) {
1747 chars = PyUnicode_Substring(self->decoded_chars,
1748 self->decoded_chars_used,
1749 self->decoded_chars_used + n);
1754 chars = self->decoded_chars;
1758 self->decoded_chars_used += n;
1765 textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
1776 * placed in self._decoded_chars (replacing its previous value). The
1781 if (self->decoder == NULL) {
1786 if (self->telling) {
1790 PyObject *state = PyObject_CallMethodNoArgs(self->decoder,
1823 /* Read a chunk, decode it, and put the result in self._decoded_chars. */
1825 size_hint = (Py_ssize_t)(Py_MAX(self->b2cratio, 1.0) * size_hint);
1827 chunk_size = PyLong_FromSsize_t(Py_MAX(self->chunk_size, size_hint));
1831 input_chunk = PyObject_CallMethodOneArg(self->buffer,
1832 (self->has_read1 ? &_Py_ID(read1): &_Py_ID(read)),
1841 "not '%.200s'", (self->has_read1 ? "read1": "read"),
1849 decoded_chars = _textiowrapper_decode(self->decoder, input_chunk, eof);
1854 textiowrapper_set_decoded_chars(self, decoded_chars);
1857 self->b2cratio = (double) nbytes / nchars;
1859 self->b2cratio = 0.0;
1863 if (self->telling) {
1878 Py_XSETREF(self->snapshot, snapshot);
1898 _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
1903 CHECK_ATTACHED(self);
1904 CHECK_CLOSED(self);
1906 if (self->decoder == NULL)
1909 if (_textiowrapper_writeflush(self) < 0)
1914 PyObject *bytes = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(read));
1919 if (Py_IS_TYPE(self->decoder, &PyIncrementalNewlineDecoder_Type))
1920 decoded = _PyIncrementalNewlineDecoder_decode(self->decoder,
1924 self->decoder, &_Py_ID(decode), bytes, Py_True, NULL);
1929 result = textiowrapper_get_decoded_chars(self, -1);
1940 textiowrapper_set_decoded_chars(self, NULL);
1941 Py_CLEAR(self->snapshot);
1948 result = textiowrapper_get_decoded_chars(self, n);
1957 res = textiowrapper_read_chunk(self, remaining);
1977 result = textiowrapper_get_decoded_chars(self, remaining);
2108 _textiowrapper_readline(textio *self, Py_ssize_t limit)
2114 CHECK_CLOSED(self);
2116 if (_textiowrapper_writeflush(self) < 0)
2129 while (!self->decoded_chars ||
2130 !PyUnicode_GET_LENGTH(self->decoded_chars)) {
2131 res = textiowrapper_read_chunk(self, 0);
2145 textiowrapper_set_decoded_chars(self, NULL);
2146 Py_CLEAR(self->snapshot);
2152 line = self->decoded_chars;
2153 start = self->decoded_chars_used;
2158 assert(self->decoded_chars_used == 0);
2159 line = PyUnicode_Concat(remaining, self->decoded_chars);
2174 self->readtranslate, self->readuniversal, self->readnl,
2221 textiowrapper_set_decoded_chars(self, NULL);
2226 self->decoded_chars_used = endpos - offset_to_buffer;
2276 _io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size)
2279 CHECK_ATTACHED(self);
2280 return _textiowrapper_readline(self, size);
2365 _textiowrapper_decoder_setstate(textio *self, cookie_type *cookie)
2375 res = PyObject_CallMethodNoArgs(self->decoder, &_Py_ID(reset));
2378 res = _PyObject_CallMethod(self->decoder, &_Py_ID(setstate),
2389 _textiowrapper_encoder_reset(textio *self, int start_of_stream)
2393 res = PyObject_CallMethodNoArgs(self->encoder, &_Py_ID(reset));
2394 self->encoding_start_of_stream = 1;
2397 res = PyObject_CallMethodOneArg(self->encoder, &_Py_ID(setstate),
2399 self->encoding_start_of_stream = 0;
2408 _textiowrapper_encoder_setstate(textio *self, cookie_type *cookie)
2412 self, cookie->start_pos == 0 && cookie->dec_flags == 0);
2423 _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence)
2432 CHECK_ATTACHED(self);
2433 CHECK_CLOSED(self);
2437 if (!self->seekable) {
2460 cookieObj = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(tell));
2476 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
2481 textiowrapper_set_decoded_chars(self, NULL);
2482 Py_CLEAR(self->snapshot);
2483 if (self->decoder) {
2484 res = PyObject_CallMethodNoArgs(self->decoder, &_Py_ID(reset));
2490 res = _PyObject_CallMethod(self->buffer, &_Py_ID(seek), "ii", 0, 2);
2494 if (self->encoder) {
2497 if (cmp < 0 || _textiowrapper_encoder_reset(self, cmp)) {
2524 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
2539 res = PyObject_CallMethodOneArg(self->buffer, &_Py_ID(seek), posobj);
2545 textiowrapper_set_decoded_chars(self, NULL);
2546 Py_CLEAR(self->snapshot);
2549 if (self->decoder) {
2550 if (_textiowrapper_decoder_setstate(self, &cookie) < 0)
2556 PyObject *input_chunk = _PyObject_CallMethod(self->buffer, &_Py_ID(read),
2576 Py_XSETREF(self->snapshot, snapshot);
2578 decoded = PyObject_CallMethodObjArgs(self->decoder, &_Py_ID(decode),
2584 textiowrapper_set_decoded_chars(self, decoded);
2587 if (PyUnicode_GetLength(self->decoded_chars) < cookie.chars_to_skip) {
2591 self->decoded_chars_used = cookie.chars_to_skip;
2597 Py_XSETREF(self->snapshot, snapshot);
2601 if (self->encoder) {
2602 if (_textiowrapper_encoder_setstate(self, &cookie) < 0)
2617 _io_TextIOWrapper_tell_impl(textio *self)
2631 CHECK_ATTACHED(self);
2632 CHECK_CLOSED(self);
2634 if (!self->seekable) {
2638 if (!self->telling) {
2644 if (_textiowrapper_writeflush(self) < 0)
2646 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
2651 posobj = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(tell));
2655 if (self->decoder == NULL || self->snapshot == NULL) {
2656 assert (self->decoded_chars == NULL || PyUnicode_GetLength(self->decoded_chars) == 0);
2670 assert(PyTuple_Check(self->snapshot));
2671 if (!PyArg_ParseTuple(self->snapshot, "iO", &cookie.dec_flags, &next_input))
2679 if (self->decoded_chars_used == 0) {
2684 chars_to_skip = self->decoded_chars_used;
2687 saved_state = PyObject_CallMethodNoArgs(self->decoder,
2694 PyObject *_state = PyObject_CallMethodNoArgs(self->decoder, \
2724 self->decoder, &_Py_ID(decode), "y#", start, len); \
2733 skip_bytes = (Py_ssize_t) (self->b2cratio * chars_to_skip);
2739 if (_textiowrapper_decoder_setstate(self, &cookie) < 0)
2762 if (_textiowrapper_decoder_setstate(self, &cookie) < 0)
2806 self->decoder, &_Py_ID(decode), "yO", "", /* final = */ Py_True);
2822 self->decoder, &_Py_ID(setstate), saved_state);
2837 self->decoder, &_Py_ID(setstate), saved_state);
2852 _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos)
2857 CHECK_ATTACHED(self)
2859 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
2864 return PyObject_CallMethodOneArg(self->buffer, &_Py_ID(truncate), pos);
2868 textiowrapper_repr(textio *self)
2873 CHECK_INITIALIZED(self);
2879 status = Py_ReprEnter((PyObject *)self);
2884 Py_TYPE(self)->tp_name);
2888 if (_PyObject_LookupAttr((PyObject *) self, &_Py_ID(name), &nameobj) < 0) {
2904 if (_PyObject_LookupAttr((PyObject *) self, &_Py_ID(mode), &modeobj) < 0) {
2917 res, self->encoding);
2920 Py_ReprLeave((PyObject *)self);
2927 Py_ReprLeave((PyObject *)self);
2940 _io_TextIOWrapper_fileno_impl(textio *self)
2943 CHECK_ATTACHED(self);
2944 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(fileno));
2952 _io_TextIOWrapper_seekable_impl(textio *self)
2955 CHECK_ATTACHED(self);
2956 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(seekable));
2964 _io_TextIOWrapper_readable_impl(textio *self)
2967 CHECK_ATTACHED(self);
2968 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(readable));
2976 _io_TextIOWrapper_writable_impl(textio *self)
2979 CHECK_ATTACHED(self);
2980 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(writable));
2988 _io_TextIOWrapper_isatty_impl(textio *self)
2991 CHECK_ATTACHED(self);
2992 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(isatty));
3000 _io_TextIOWrapper_flush_impl(textio *self)
3003 CHECK_ATTACHED(self);
3004 CHECK_CLOSED(self);
3005 self->telling = self->seekable;
3006 if (_textiowrapper_writeflush(self) < 0)
3008 return PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(flush));
3016 _io_TextIOWrapper_close_impl(textio *self)
3021 CHECK_ATTACHED(self);
3023 res = textiowrapper_closed_get(self, NULL);
3036 if (self->finalizing) {
3037 res = PyObject_CallMethodOneArg(self->buffer, &_Py_ID(_dealloc_warn),
3038 (PyObject *)self);
3044 res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
3050 res = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(close));
3060 textiowrapper_iternext(textio *self)
3064 CHECK_ATTACHED(self);
3066 self->telling = 0;
3067 if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) {
3069 line = _textiowrapper_readline(self, -1);
3072 line = PyObject_CallMethodNoArgs((PyObject *)self,
3089 Py_CLEAR(self->snapshot);
3090 self->telling = self->seekable;
3098 textiowrapper_name_get(textio *self, void *context)
3100 CHECK_ATTACHED(self);
3101 return PyObject_GetAttr(self->buffer, &_Py_ID(name));
3105 textiowrapper_closed_get(textio *self, void *context)
3107 CHECK_ATTACHED(self);
3108 return PyObject_GetAttr(self->buffer, &_Py_ID(closed));
3112 textiowrapper_newlines_get(textio *self, void *context)
3115 CHECK_ATTACHED(self);
3116 if (self->decoder == NULL ||
3117 _PyObject_LookupAttr(self->decoder, &_Py_ID(newlines), &res) == 0)
3125 textiowrapper_errors_get(textio *self, void *context)
3127 CHECK_INITIALIZED(self);
3128 Py_INCREF(self->errors);
3129 return self->errors;
3133 textiowrapper_chunk_size_get(textio *self, void *context)
3135 CHECK_ATTACHED(self);
3136 return PyLong_FromSsize_t(self->chunk_size);
3140 textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context)
3143 CHECK_ATTACHED_INT(self);
3156 self->chunk_size = n;