[PATCH STABLE] python-zstandard: apply big-endian fix (issue6188)

Yuya Nishihara yuya at tcha.org
Mon Aug 26 08:27:48 EDT 2019


On Sun, 25 Aug 2019 09:01:58 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1566748826 25200
> #      Sun Aug 25 09:00:26 2019 -0700
> # Branch stable
> # Node ID 0da517c3ff6ce9e0ea014a85fb7344eca61b97b2
> # Parent  7521e6d18057bfc41614d63c85424c50ee114cdf
> python-zstandard: apply big-endian fix (issue6188)

Even if this doesn't fix the issue, the change looks good. Queued, thanks.

> This is a port of commit d4baf1f95b811f40773f5df0d8780fb2111ba6f5
> from the upstream project to fix python-zstandard on 64-bit big-endian.
> 
> diff --git a/contrib/python-zstandard/c-ext/decompressor.c b/contrib/python-zstandard/c-ext/decompressor.c
> --- a/contrib/python-zstandard/c-ext/decompressor.c
> +++ b/contrib/python-zstandard/c-ext/decompressor.c
> @@ -68,13 +68,13 @@ static int Decompressor_init(ZstdDecompr
>  	};
>  
>  	ZstdCompressionDict* dict = NULL;
> -	size_t maxWindowSize = 0;
> +	Py_ssize_t maxWindowSize = 0;
>  	ZSTD_format_e format = ZSTD_f_zstd1;
>  
>  	self->dctx = NULL;
>  	self->dict = NULL;
>  
> -	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!II:ZstdDecompressor", kwlist,
> +	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!nI:ZstdDecompressor", kwlist,
>  		&ZstdCompressionDictType, &dict, &maxWindowSize, &format)) {

Nit: enum can be narrower than int, though it's unlikely on most PC platforms.


More information about the Mercurial-devel mailing list