Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit c3dff8f

Browse files
committed
common: share the zlib stream engine
Move the VM-independent zlib-rs stream owner and state machine into a feature-gated rustpython-common module. Make rustpython-stdlib adapt that engine instead of carrying its own flate2 implementation, including native stream copy/deepcopy, Z_BLOCK flushes, and wbits=0 decompression. Assisted-by: Codex:GPT-5
1 parent 6a3a8b0 commit c3dff8f

11 files changed

Lines changed: 1223 additions & 435 deletions

File tree

‎Cargo.lock‎

Lines changed: 2 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ dyn-clone = "1.0.10"
215215
exitcode = "1.1.2"
216216
flame = "0.2.2"
217217
flamer = "0.5"
218-
flate2 = { version = "1.1.9", default-features = false }
219218
# Bump only when the openssl crate bumps it
220219
foreign-types-shared = "0.1"
221220
gethostname = "1.0.2"
@@ -241,6 +240,7 @@ xz = "0.4.6-rc.0"
241240
xz-sys = "0.4.6-rc.0"
242241
libsqlite3-sys = "0.38"
243242
libz-rs-sys = "0.6"
243+
zlib-rs = { version = "0.6", default-features = false, features = ["rust-allocator", "__internal-api"] }
244244
lock_api = "0.4"
245245
log = "0.4.30"
246246
lz4_flex = "0.13"

‎Lib/test/test_zlib.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ def test_clear_unconsumed_tail(self):
489489
ddata += dco.decompress(dco.unconsumed_tail)
490490
self.assertEqual(dco.unconsumed_tail, b"")
491491

492-
@unittest.expectedFailure # TODO: RUSTPYTHON; Z_BLOCK support in flate2
493492
def test_flushes(self):
494493
# Test flush() with the various options, using all the
495494
# different levels in order to provide more variations.
@@ -809,7 +808,6 @@ def test_large_unconsumed_tail(self, size):
809808
finally:
810809
comp = uncomp = data = None
811810

812-
@unittest.expectedFailure # TODO: RUSTPYTHON; wbits=0 support in flate2
813811
def test_wbits(self):
814812
# wbits=0 only supported since zlib v1.2.3.5
815813
supports_wbits_0 = ZLIB_RUNTIME_VERSION_TUPLE >= (1, 2, 3, 5)

‎crates/common/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ json = ["dep:memchr", "std"]
1717
std = []
1818
threading = ["parking_lot", "std"]
1919
wasm_js = ["getrandom/wasm_js"]
20+
zlib = ["std", "dep:libz-rs-sys", "dep:zlib-rs"]
2021

2122
[dependencies]
2223
rustpython-literal = { workspace = true }
@@ -30,13 +31,15 @@ crc32fast = { workspace = true, optional = true }
3031
getrandom = { workspace = true }
3132
itertools = { workspace = true }
3233
libc = { workspace = true }
34+
libz-rs-sys = { workspace = true, optional = true }
3335
malachite-bigint = { workspace = true }
3436
malachite-q = { workspace = true }
3537
malachite-base = { workspace = true }
3638
memchr = { workspace = true, optional = true }
3739
num-traits = { workspace = true }
3840
parking_lot = { workspace = true, optional = true }
3941
radium = { workspace = true }
42+
zlib-rs = { workspace = true, optional = true }
4043

4144
lock_api = { workspace = true }
4245
siphasher = { workspace = true }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! VM-independent compression engines shared by RustPython components.
2+
3+
pub mod zlib;

0 commit comments

Comments
 (0)