修复了大量存在的问题,增加了假鸭子类型等等机制

This commit is contained in:
2026-06-25 14:49:46 +08:00
parent 19f2787db0
commit d88d11b646
827 changed files with 32617 additions and 18316 deletions

View File

@@ -59,7 +59,7 @@ DEF_MEM_LEVEL: t.CDefine = 8
# Version
ZLIB_VERSION: t.CDefine = "1.3.2"
pyzlib_error_msg: list[t.CChar, 512] = ""
pyzlib_error_msg: t.CArray[t.CChar, 512] = ""
pyzlib_error_code_val: t.CInt = 0
# ============================================================
@@ -552,7 +552,9 @@ def compress(pool: mpool.MPool | t.CPtr, data: BYTEPTR, data_len: t.CSizeT,
actual_wbits: t.CInt = wbits
if wbits > MAX_WBITS:
actual_wbits = -MAX_WBITS
stdio.printf("[DEBUG] compress: calling zdeflate_one_shot, pool=%p, data=%p, len=%zu, level=%d, wbits=%d\n", pool, data, data_len, level, actual_wbits)
raw_result: UINT8PTR = zdeflate.zdeflate_one_shot(pool, data, data_len, level, actual_wbits, out_len)
stdio.printf("[DEBUG] compress: zdeflate_one_shot returned %p\n", raw_result)
if not raw_result:
set_error(Z_DATA_ERROR, "compression failed")
return None