comparison contrib/python-zstandard/zstandard/cffi.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
271 ldm_bucket_size_log=0, 271 ldm_bucket_size_log=0,
272 ldm_hash_rate_log=-1, 272 ldm_hash_rate_log=-1,
273 ldm_hash_every_log=-1, 273 ldm_hash_every_log=-1,
274 threads=0, 274 threads=0,
275 ): 275 ):
276
276 params = lib.ZSTD_createCCtxParams() 277 params = lib.ZSTD_createCCtxParams()
277 if params == ffi.NULL: 278 if params == ffi.NULL:
278 raise MemoryError() 279 raise MemoryError()
279 280
280 params = ffi.gc(params, lib.ZSTD_freeCCtxParams) 281 params = ffi.gc(params, lib.ZSTD_freeCCtxParams)
1420 ofh, 1421 ofh,
1421 size=-1, 1422 size=-1,
1422 read_size=COMPRESSION_RECOMMENDED_INPUT_SIZE, 1423 read_size=COMPRESSION_RECOMMENDED_INPUT_SIZE,
1423 write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE, 1424 write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE,
1424 ): 1425 ):
1426
1425 if not hasattr(ifh, "read"): 1427 if not hasattr(ifh, "read"):
1426 raise ValueError("first argument must have a read() method") 1428 raise ValueError("first argument must have a read() method")
1427 if not hasattr(ofh, "write"): 1429 if not hasattr(ofh, "write"):
1428 raise ValueError("second argument must have a write() method") 1430 raise ValueError("second argument must have a write() method")
1429 1431
1519 writer, 1521 writer,
1520 size=-1, 1522 size=-1,
1521 write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE, 1523 write_size=COMPRESSION_RECOMMENDED_OUTPUT_SIZE,
1522 write_return_read=False, 1524 write_return_read=False,
1523 ): 1525 ):
1526
1524 if not hasattr(writer, "write"): 1527 if not hasattr(writer, "write"):
1525 raise ValueError("must pass an object with a write() method") 1528 raise ValueError("must pass an object with a write() method")
1526 1529
1527 lib.ZSTD_CCtx_reset(self._cctx, lib.ZSTD_reset_session_only) 1530 lib.ZSTD_CCtx_reset(self._cctx, lib.ZSTD_reset_session_only)
1528 1531