/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to parser.py

reduce memory usage while reading large blobs

Show diffs side-by-side

added added

removed removed

Lines of Context:
218
218
 
219
219
        :return: a string
220
220
        """
221
 
        lines = []
 
221
        lines = ''
222
222
        left = count
223
223
        found = 0
224
224
        while left > 0:
227
227
                line_len = len(line)
228
228
                left -= line_len
229
229
                found += line_len
230
 
                lines.append(line)
 
230
                lines += line
231
231
                if line.endswith('\n'):
232
232
                    self.lineno += 1
233
233
            else:
234
234
                left = 0
235
235
        if found != count:
236
236
            self.abort(errors.MissingBytes, count, found)
237
 
        return ''.join(lines)
 
237
        return lines
238
238
 
239
239
    def read_until(self, terminator):
240
240
        """Read the input stream until the terminator is found.