'Replace string directly without appending to an empty string,
avoiding type issues.'

def _buf_append(self, string):

    if (not self._buf):
        self._buf = string
    else:
        self._buf += string
