@@ -19,7 +19,11 @@ _Py_IDENTIFIER(fileno);
1919_Py_IDENTIFIER (flush );
2020_Py_IDENTIFIER (getpreferredencoding );
2121_Py_IDENTIFIER (isatty );
22+ _Py_IDENTIFIER (mode );
23+ _Py_IDENTIFIER (name );
24+ _Py_IDENTIFIER (raw );
2225_Py_IDENTIFIER (read );
26+ _Py_IDENTIFIER (read1 );
2327_Py_IDENTIFIER (readable );
2428_Py_IDENTIFIER (replace );
2529_Py_IDENTIFIER (reset );
@@ -999,7 +1003,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
9991003 ci = _PyCodec_Lookup (encoding );
10001004 if (ci == NULL )
10011005 goto error ;
1002- res = PyObject_GetAttrString (ci , "name" );
1006+ res = _PyObject_GetAttrId (ci , & PyId_name );
10031007 Py_DECREF (ci );
10041008 if (res == NULL ) {
10051009 if (PyErr_ExceptionMatches (PyExc_AttributeError ))
@@ -1026,7 +1030,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
10261030 if (Py_TYPE (buffer ) == & PyBufferedReader_Type ||
10271031 Py_TYPE (buffer ) == & PyBufferedWriter_Type ||
10281032 Py_TYPE (buffer ) == & PyBufferedRandom_Type ) {
1029- raw = PyObject_GetAttrString (buffer , "raw" );
1033+ raw = _PyObject_GetAttrId (buffer , & PyId_raw );
10301034 /* Cache the raw FileIO object to speed up 'closed' checks */
10311035 if (raw == NULL ) {
10321036 if (PyErr_ExceptionMatches (PyExc_AttributeError ))
@@ -1046,7 +1050,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
10461050 self -> seekable = self -> telling = PyObject_IsTrue (res );
10471051 Py_DECREF (res );
10481052
1049- self -> has_read1 = PyObject_HasAttrString (buffer , "read1" );
1053+ self -> has_read1 = _PyObject_HasAttrId (buffer , & PyId_read1 );
10501054
10511055 self -> encoding_start_of_stream = 0 ;
10521056 if (self -> seekable && self -> encoder ) {
@@ -2401,7 +2405,7 @@ textiowrapper_repr(textio *self)
24012405 res = PyUnicode_FromString ("<_io.TextIOWrapper" );
24022406 if (res == NULL )
24032407 return NULL ;
2404- nameobj = PyObject_GetAttrString ((PyObject * ) self , "name" );
2408+ nameobj = _PyObject_GetAttrId ((PyObject * ) self , & PyId_name );
24052409 if (nameobj == NULL ) {
24062410 if (PyErr_ExceptionMatches (PyExc_AttributeError ))
24072411 PyErr_Clear ();
@@ -2417,7 +2421,7 @@ textiowrapper_repr(textio *self)
24172421 if (res == NULL )
24182422 return NULL ;
24192423 }
2420- modeobj = PyObject_GetAttrString ((PyObject * ) self , "mode" );
2424+ modeobj = _PyObject_GetAttrId ((PyObject * ) self , & PyId_mode );
24212425 if (modeobj == NULL ) {
24222426 if (PyErr_ExceptionMatches (PyExc_AttributeError ))
24232427 PyErr_Clear ();
@@ -2578,7 +2582,7 @@ static PyObject *
25782582textiowrapper_name_get (textio * self , void * context )
25792583{
25802584 CHECK_INITIALIZED (self );
2581- return PyObject_GetAttrString (self -> buffer , "name" );
2585+ return _PyObject_GetAttrId (self -> buffer , & PyId_name );
25822586}
25832587
25842588static PyObject *
0 commit comments