Age | Commit message (Collapse) | Author |
|
|
|
|
|
When the decompression ratio is huge, we may be faced with a large
(multiple megabytes) bytes object. Slicing that object incurs a copy
becomes O(n^2) while appending and trimming a bytearray is much faster.
|
|
Fixes: 775bdde52ad5 ("DecompressedStream: avoid mixing types for variable data")
|
|
The local variable data can be bool or bytes. That's inconvenient for
static type checkers. Avoid doing so.
|
|
|
|
|
|
In Python 3.x, lzma.LZMADecompressor doesn't have a flush method.
|
|
Iteration over file-like is required by deb822.Packages.iter_paragraphs.
|
|
The handle_ar_member and handle_ar_end methods now have a default
implementation adding further handlers handle_debversion,
handle_control_tar and handle_data_tar.
In that process two additional bugs were fixed:
* decompress_tar was wrongly passing errors="surrogateescape" for
Python 2.x even though that's only supported for Python 3.x.
* The use of decompress actually passes the extension as unicode.
|
|
Building on the previous commit, add a decompress function that turns a
compressed filelike into a decompressed filelike. Use it to decouple the
decompression step.
|
|
It now supports:
* tell()
* seek(absolute_position), forward only
* close()
* closed
This is sufficient for putting it as a fileobj into tarfile.TarFile. By
doing so we can decouple decompression from tar processing, which eases
papering over the Python 2.x vs Python 3.x differences.
|
|
|
|
zlib.crc32 returns a int32_t on py2 and a uint32_t on py3.
|
|
|
|
|
|
|