'Reads a file into a list of strings.  It calls :meth:`readline`
until the file is read to the end.  It does support the optional
`size` argument if the underlaying stream supports it for
`readline`.'

def readlines(self, size=None):

    last_pos = self._pos
    result = []
    if (size is not None):
        end = min(self.limit, (last_pos + size))
    else:
        end = self.limit
    while 1:
        if (size is not None):
            size -= (last_pos - self._pos)
        if (self._pos >= end):
            break
        result.append(self.readline(size))
        if (size is not None):
            last_pos = self._pos
    return result
