@@ -897,7 +897,7 @@ _textiowrapper_decode(PyObject *decoder, PyObject *bytes, int eof)
897
897
{
898
898
PyObject * chars ;
899
899
900
- if (Py_TYPE (decoder ) == & PyIncrementalNewlineDecoder_Type )
900
+ if (Py_IS_TYPE (decoder , & PyIncrementalNewlineDecoder_Type ) )
901
901
chars = _PyIncrementalNewlineDecoder_decode (decoder , bytes , eof );
902
902
else
903
903
chars = PyObject_CallMethodObjArgs (decoder , _PyIO_str_decode , bytes ,
@@ -1226,15 +1226,15 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
1226
1226
/* Finished sorting out the codec details */
1227
1227
Py_CLEAR (codec_info );
1228
1228
1229
- if (Py_TYPE (buffer ) == & PyBufferedReader_Type ||
1230
- Py_TYPE (buffer ) == & PyBufferedWriter_Type ||
1231
- Py_TYPE (buffer ) == & PyBufferedRandom_Type )
1229
+ if (Py_IS_TYPE (buffer , & PyBufferedReader_Type ) ||
1230
+ Py_IS_TYPE (buffer , & PyBufferedWriter_Type ) ||
1231
+ Py_IS_TYPE (buffer , & PyBufferedRandom_Type ) )
1232
1232
{
1233
1233
if (_PyObject_LookupAttrId (buffer , & PyId_raw , & raw ) < 0 )
1234
1234
goto error ;
1235
1235
/* Cache the raw FileIO object to speed up 'closed' checks */
1236
1236
if (raw != NULL ) {
1237
- if (Py_TYPE (raw ) == & PyFileIO_Type )
1237
+ if (Py_IS_TYPE (raw , & PyFileIO_Type ) )
1238
1238
self -> raw = raw ;
1239
1239
else
1240
1240
Py_DECREF (raw );
@@ -1466,7 +1466,7 @@ textiowrapper_closed_get(textio *self, void *context);
1466
1466
do { \
1467
1467
int r; \
1468
1468
PyObject *_res; \
1469
- if (Py_TYPE (self) == &PyTextIOWrapper_Type) { \
1469
+ if (Py_IS_TYPE (self, &PyTextIOWrapper_Type) ) { \
1470
1470
if (self->raw != NULL) \
1471
1471
r = _PyFileIO_closed(self->raw); \
1472
1472
else { \
@@ -1937,7 +1937,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
1937
1937
if (bytes == NULL )
1938
1938
goto fail ;
1939
1939
1940
- if (Py_TYPE (self -> decoder ) == & PyIncrementalNewlineDecoder_Type )
1940
+ if (Py_IS_TYPE (self -> decoder , & PyIncrementalNewlineDecoder_Type ) )
1941
1941
decoded = _PyIncrementalNewlineDecoder_decode (self -> decoder ,
1942
1942
bytes , 1 );
1943
1943
else
@@ -3079,7 +3079,7 @@ textiowrapper_iternext(textio *self)
3079
3079
CHECK_ATTACHED (self );
3080
3080
3081
3081
self -> telling = 0 ;
3082
- if (Py_TYPE (self ) == & PyTextIOWrapper_Type ) {
3082
+ if (Py_IS_TYPE (self , & PyTextIOWrapper_Type ) ) {
3083
3083
/* Skip method call overhead for speed */
3084
3084
line = _textiowrapper_readline (self , -1 );
3085
3085
}
0 commit comments