Use compression.zstd (PEP-784) (#2769)

* Use compression.zstd (PEP-784)

* Add changelog entry
This commit is contained in:
Rogdham
2026-08-28 13:54:23 +02:00
committed by GitHub
parent b22998ab12
commit d9eff01662
3 changed files with 9 additions and 12 deletions
+2
View File
@@ -147,6 +147,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#2735][2735] Add support for debugging with x64dbg on Windows
- [#2767][2767] Support paginated libc.rip API requests to include all search results
- [#2726][2726] feat(libcdb): use local debuginfod client cache before hitting servers
- [#2769][2769] Use standard library (PEP-784) for Zstandard decompression
[2675]: https://github.com/Gallopsled/pwntools/pull/2675
[2652]: https://github.com/Gallopsled/pwntools/pull/2652
@@ -219,6 +220,7 @@ The table below shows which release corresponds to each branch, and what date th
[2762]: https://github.com/Gallopsled/pwntools/pull/2762
[2767]: https://github.com/Gallopsled/pwntools/pull/2767
[2726]: https://github.com/Gallopsled/pwntools/pull/2726
[2769]: https://github.com/Gallopsled/pwntools/pull/2769
## 4.15.1
+6 -11
View File
@@ -510,17 +510,12 @@ def unstrip_libc(filename):
return True
def _extract_tarfile(cache_dir, data_filename, tarball):
from io import BytesIO
import tarfile
# Handle zstandard compression, since tarfile only supports gz, bz2, and xz.
if data_filename.endswith('.zst') or data_filename.endswith('.zstd'):
import zstandard
dctx = zstandard.ZstdDecompressor()
decompressed_tar = BytesIO()
dctx.copy_stream(tarball, decompressed_tar)
decompressed_tar.seek(0)
tarball.close()
tarball = decompressed_tar
import sys
if sys.version_info >= (3, 14):
import tarfile
else:
# for zstandard support in tarfile
from backports.zstd import tarfile
with tarfile.open(fileobj=tarball) as tar_file:
# Find the library folder in the archive (e.g. /lib/x86_64-linux-gnu/)
+1 -1
View File
@@ -50,7 +50,7 @@ dependencies = [
"rpyc",
"colored_traceback",
"unix-ar",
"zstandard",
"backports.zstd>=1.0.0 ; python_version<'3.14'",
]
[project.urls]