diff options
author | Andy Lester <andy@petdance.com> | 2020-03-04 13:15:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 13:15:20 (GMT) |
commit | dffe4c07095e0c693e094d3c140e85a68bd8128e (patch) | |
tree | 1f58f4c2f76d6f630c5279a7b72d31bb6b4d8873 /Modules/_io/textio.c | |
parent | 22a9a546ff3bf2a63d77ca1e5494e758bc59132f (diff) | |
download | cpython-dffe4c07095e0c693e094d3c140e85a68bd8128e.zip cpython-dffe4c07095e0c693e094d3c140e85a68bd8128e.tar.gz cpython-dffe4c07095e0c693e094d3c140e85a68bd8128e.tar.bz2 |
bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r-- | Modules/_io/textio.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 3a9ce93..dedbefe 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -897,7 +897,7 @@ _textiowrapper_decode(PyObject *decoder, PyObject *bytes, int eof) { PyObject *chars; - if (Py_TYPE(decoder) == &PyIncrementalNewlineDecoder_Type) + if (Py_IS_TYPE(decoder, &PyIncrementalNewlineDecoder_Type)) chars = _PyIncrementalNewlineDecoder_decode(decoder, bytes, eof); else chars = PyObject_CallMethodObjArgs(decoder, _PyIO_str_decode, bytes, @@ -1226,15 +1226,15 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, /* Finished sorting out the codec details */ Py_CLEAR(codec_info); - if (Py_TYPE(buffer) == &PyBufferedReader_Type || - Py_TYPE(buffer) == &PyBufferedWriter_Type || - Py_TYPE(buffer) == &PyBufferedRandom_Type) + if (Py_IS_TYPE(buffer, &PyBufferedReader_Type) || + Py_IS_TYPE(buffer, &PyBufferedWriter_Type) || + Py_IS_TYPE(buffer, &PyBufferedRandom_Type)) { if (_PyObject_LookupAttrId(buffer, &PyId_raw, &raw) < 0) goto error; /* Cache the raw FileIO object to speed up 'closed' checks */ if (raw != NULL) { - if (Py_TYPE(raw) == &PyFileIO_Type) + if (Py_IS_TYPE(raw, &PyFileIO_Type)) self->raw = raw; else Py_DECREF(raw); @@ -1466,7 +1466,7 @@ textiowrapper_closed_get(textio *self, void *context); do { \ int r; \ PyObject *_res; \ - if (Py_TYPE(self) == &PyTextIOWrapper_Type) { \ + if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) { \ if (self->raw != NULL) \ r = _PyFileIO_closed(self->raw); \ else { \ @@ -1937,7 +1937,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n) if (bytes == NULL) goto fail; - if (Py_TYPE(self->decoder) == &PyIncrementalNewlineDecoder_Type) + if (Py_IS_TYPE(self->decoder, &PyIncrementalNewlineDecoder_Type)) decoded = _PyIncrementalNewlineDecoder_decode(self->decoder, bytes, 1); else @@ -3079,7 +3079,7 @@ textiowrapper_iternext(textio *self) CHECK_ATTACHED(self); self->telling = 0; - if (Py_TYPE(self) == &PyTextIOWrapper_Type) { + if (Py_IS_TYPE(self, &PyTextIOWrapper_Type)) { /* Skip method call overhead for speed */ line = _textiowrapper_readline(self, -1); } |