@@ -677,60 +677,47 @@ PyInit__io(void)
677677 ADD_TYPE (& PyIncrementalNewlineDecoder_Type , "IncrementalNewlineDecoder" );
678678
679679 /* Interned strings */
680- if (!(_PyIO_str_close = PyUnicode_InternFromString ("close" )))
681- goto fail ;
682- if (!(_PyIO_str_closed = PyUnicode_InternFromString ("closed" )))
683- goto fail ;
684- if (!(_PyIO_str_decode = PyUnicode_InternFromString ("decode" )))
685- goto fail ;
686- if (!(_PyIO_str_encode = PyUnicode_InternFromString ("encode" )))
687- goto fail ;
688- if (!(_PyIO_str_fileno = PyUnicode_InternFromString ("fileno" )))
689- goto fail ;
690- if (!(_PyIO_str_flush = PyUnicode_InternFromString ("flush" )))
691- goto fail ;
692- if (!(_PyIO_str_getstate = PyUnicode_InternFromString ("getstate" )))
693- goto fail ;
694- if (!(_PyIO_str_isatty = PyUnicode_InternFromString ("isatty" )))
695- goto fail ;
696- if (!(_PyIO_str_newlines = PyUnicode_InternFromString ("newlines" )))
697- goto fail ;
698- if (!(_PyIO_str_nl = PyUnicode_InternFromString ("\n" )))
699- goto fail ;
700- if (!(_PyIO_str_read = PyUnicode_InternFromString ("read" )))
701- goto fail ;
702- if (!(_PyIO_str_read1 = PyUnicode_InternFromString ("read1" )))
703- goto fail ;
704- if (!(_PyIO_str_readable = PyUnicode_InternFromString ("readable" )))
705- goto fail ;
706- if (!(_PyIO_str_readall = PyUnicode_InternFromString ("readall" )))
707- goto fail ;
708- if (!(_PyIO_str_readinto = PyUnicode_InternFromString ("readinto" )))
709- goto fail ;
710- if (!(_PyIO_str_readline = PyUnicode_InternFromString ("readline" )))
711- goto fail ;
712- if (!(_PyIO_str_reset = PyUnicode_InternFromString ("reset" )))
713- goto fail ;
714- if (!(_PyIO_str_seek = PyUnicode_InternFromString ("seek" )))
715- goto fail ;
716- if (!(_PyIO_str_seekable = PyUnicode_InternFromString ("seekable" )))
717- goto fail ;
718- if (!(_PyIO_str_setstate = PyUnicode_InternFromString ("setstate" )))
719- goto fail ;
720- if (!(_PyIO_str_tell = PyUnicode_InternFromString ("tell" )))
721- goto fail ;
722- if (!(_PyIO_str_truncate = PyUnicode_InternFromString ("truncate" )))
723- goto fail ;
724- if (!(_PyIO_str_write = PyUnicode_InternFromString ("write" )))
725- goto fail ;
726- if (!(_PyIO_str_writable = PyUnicode_InternFromString ("writable" )))
727- goto fail ;
728-
729- if (!(_PyIO_empty_str = PyUnicode_FromStringAndSize (NULL , 0 )))
730- goto fail ;
731- if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize (NULL , 0 )))
732- goto fail ;
733- if (!(_PyIO_zero = PyLong_FromLong (0L )))
680+ #define ADD_INTERNED (name ) \
681+ if (!_PyIO_str_ ## name && \
682+ !(_PyIO_str_ ## name = PyUnicode_InternFromString(# name))) \
683+ goto fail;
684+
685+ ADD_INTERNED (close )
686+ ADD_INTERNED (closed )
687+ ADD_INTERNED (decode )
688+ ADD_INTERNED (encode )
689+ ADD_INTERNED (fileno )
690+ ADD_INTERNED (flush )
691+ ADD_INTERNED (getstate )
692+ ADD_INTERNED (isatty )
693+ ADD_INTERNED (newlines )
694+ ADD_INTERNED (read )
695+ ADD_INTERNED (read1 )
696+ ADD_INTERNED (readable )
697+ ADD_INTERNED (readall )
698+ ADD_INTERNED (readinto )
699+ ADD_INTERNED (readline )
700+ ADD_INTERNED (reset )
701+ ADD_INTERNED (seek )
702+ ADD_INTERNED (seekable )
703+ ADD_INTERNED (setstate )
704+ ADD_INTERNED (tell )
705+ ADD_INTERNED (truncate )
706+ ADD_INTERNED (write )
707+ ADD_INTERNED (writable )
708+
709+ if (!_PyIO_str_nl &&
710+ !(_PyIO_str_nl = PyUnicode_InternFromString ("\n ")))
711+ goto fail ;
712+
713+ if (!_PyIO_empty_str &&
714+ !(_PyIO_empty_str = PyUnicode_FromStringAndSize (NULL , 0 )))
715+ goto fail ;
716+ if (!_PyIO_empty_bytes &&
717+ !(_PyIO_empty_bytes = PyBytes_FromStringAndSize (NULL , 0 )))
718+ goto fail ;
719+ if (!_PyIO_zero &&
720+ !(_PyIO_zero = PyLong_FromLong (0L )))
734721 goto fail ;
735722
736723 state -> initialized = 1 ;
0 commit comments