(self, line)
line is always bytes, not string
line is always bytes, not string
line is always bytes not string
def __write(self, line):
        """line is always bytes, not string"""
        if self.__file is not None:
            if self.__file.tell() + len(line) > 1000:
                self.file = self.make_file()
                data = self.__file.getvalue()
                self.file.write(data)
                self.__file = None
        if self._binary_file:
            # keep bytes
            self.file.write(line)
        else:
            # decode to string
            self.file.write(line.decode(self.encoding, self.errors))
def __write ( self , line ) : if self . __file is not None : if self . __file . tell ( ) + len ( line ) > 1000 : self . file = self . make_file ( ) data = self . __file . getvalue ( ) self . file . write ( data ) self . __file = None if self . _binary_file : # keep bytes self . file . write ( line ) else : # decode to string self . file . write ( line . decode ( self . encoding , self . errors ) )