@@ -583,13 +583,18 @@ iomodule_traverse(PyObject *mod, visitproc visit, void *arg) {
583583 Py_VISIT (state -> locale_module );
584584 Py_VISIT (state -> unsupported_operation );
585585
586+ Py_VISIT (state -> PyIncrementalNewlineDecoder_Type );
587+ Py_VISIT (state -> PyRawIOBase_Type );
588+ Py_VISIT (state -> PyBufferedIOBase_Type );
586589 Py_VISIT (state -> PyBufferedRWPair_Type );
587590 Py_VISIT (state -> PyBufferedRandom_Type );
588591 Py_VISIT (state -> PyBufferedReader_Type );
589592 Py_VISIT (state -> PyBufferedWriter_Type );
593+ Py_VISIT (state -> PyBytesIOBuffer_Type );
590594 Py_VISIT (state -> PyBytesIO_Type );
591595 Py_VISIT (state -> PyFileIO_Type );
592596 Py_VISIT (state -> PyStringIO_Type );
597+ Py_VISIT (state -> PyTextIOBase_Type );
593598 Py_VISIT (state -> PyTextIOWrapper_Type );
594599 return 0 ;
595600}
@@ -604,13 +609,18 @@ iomodule_clear(PyObject *mod) {
604609 Py_CLEAR (state -> locale_module );
605610 Py_CLEAR (state -> unsupported_operation );
606611
612+ Py_CLEAR (state -> PyIncrementalNewlineDecoder_Type );
613+ Py_CLEAR (state -> PyRawIOBase_Type );
614+ Py_CLEAR (state -> PyBufferedIOBase_Type );
607615 Py_CLEAR (state -> PyBufferedRWPair_Type );
608616 Py_CLEAR (state -> PyBufferedRandom_Type );
609617 Py_CLEAR (state -> PyBufferedReader_Type );
610618 Py_CLEAR (state -> PyBufferedWriter_Type );
619+ Py_CLEAR (state -> PyBytesIOBuffer_Type );
611620 Py_CLEAR (state -> PyBytesIO_Type );
612621 Py_CLEAR (state -> PyFileIO_Type );
613622 Py_CLEAR (state -> PyStringIO_Type );
623+ Py_CLEAR (state -> PyTextIOBase_Type );
614624 Py_CLEAR (state -> PyTextIOWrapper_Type );
615625 return 0 ;
616626}
@@ -749,24 +759,33 @@ PyInit__io(void)
749759 }
750760 }
751761
762+ // Base classes
763+ state -> PyIncrementalNewlineDecoder_Type = (PyTypeObject * )Py_NewRef (& PyIncrementalNewlineDecoder_Type );
764+
765+ // PyIOBase_Type subclasses
766+ state -> PyRawIOBase_Type = (PyTypeObject * )Py_NewRef (& PyRawIOBase_Type );
767+ state -> PyBufferedIOBase_Type = (PyTypeObject * )Py_NewRef (& PyBufferedIOBase_Type );
768+ state -> PyTextIOBase_Type = (PyTypeObject * )Py_NewRef (& PyTextIOBase_Type );
769+
752770 // PyBufferedIOBase_Type(PyIOBase_Type) subclasses
753- ADD_TYPE (m , state -> PyBytesIO_Type , & bytesio_spec , & PyBufferedIOBase_Type );
771+ ADD_TYPE (m , state -> PyBytesIO_Type , & bytesio_spec , state -> PyBufferedIOBase_Type );
754772 ADD_TYPE (m , state -> PyBufferedWriter_Type , & bufferedwriter_spec ,
755- & PyBufferedIOBase_Type );
773+ state -> PyBufferedIOBase_Type );
756774 ADD_TYPE (m , state -> PyBufferedReader_Type , & bufferedreader_spec ,
757- & PyBufferedIOBase_Type );
775+ state -> PyBufferedIOBase_Type );
758776 ADD_TYPE (m , state -> PyBufferedRWPair_Type , & bufferedrwpair_spec ,
759- & PyBufferedIOBase_Type );
777+ state -> PyBufferedIOBase_Type );
760778 ADD_TYPE (m , state -> PyBufferedRandom_Type , & bufferedrandom_spec ,
761- & PyBufferedIOBase_Type );
779+ state -> PyBufferedIOBase_Type );
762780
763781 // PyRawIOBase_Type(PyIOBase_Type) subclasses
764- ADD_TYPE (m , state -> PyFileIO_Type , & fileio_spec , & PyRawIOBase_Type );
782+ state -> PyBytesIOBuffer_Type = (PyTypeObject * )Py_NewRef (& _PyBytesIOBuffer_Type );
783+ ADD_TYPE (m , state -> PyFileIO_Type , & fileio_spec , state -> PyRawIOBase_Type );
765784
766785 // PyTextIOBase_Type(PyIOBase_Type) subclasses
767- ADD_TYPE (m , state -> PyStringIO_Type , & stringio_spec , & PyTextIOBase_Type );
786+ ADD_TYPE (m , state -> PyStringIO_Type , & stringio_spec , state -> PyTextIOBase_Type );
768787 ADD_TYPE (m , state -> PyTextIOWrapper_Type , & textiowrapper_spec ,
769- & PyTextIOBase_Type );
788+ state -> PyTextIOBase_Type );
770789
771790 state -> initialized = 1 ;
772791
0 commit comments