Ticket #7581: text.py.diff

File text.py.diff, 686 bytes (added by didditdoug, 10 years ago)

Bug fix for invalid compression output in compress_sequence

  • text.py

     
    177177    zfile.close()
    178178    return zbuf.getvalue()
    179179
     180# WARNING - be aware that compress_sequence does not achieve the same
     181# level of compression as compress_string
     182#
    180183def compress_sequence(sequence, charset):
    181184    import cStringIO, zlib
    182185    import flushable_gzip as gzip
     
    189192        zfile.flush()
    190193        zbuf.seek(position)
    191194        yield zbuf.read()
     195   
     196    position = zbuf.tell()
     197    zfile.close()
     198    zbuf.seek(position)
     199    yield zbuf.read()
    192200
    193201ustring_re = re.compile(u"([\u0080-\uffff])")
    194202
Back to Top