D5235: revlog: replace PyInt_AS_LONG with a more portable helper function

Yuya Nishihara yuya at tcha.org
Thu Nov 8 06:26:20 EST 2018


> @@ -464,7 +470,9 @@
>  		if (iter == NULL)
>  			return -2;
>  		while ((iter_item = PyIter_Next(iter))) {
> -			iter_item_long = PyInt_AS_LONG(iter_item);
> +			if (!pylong_to_long(iter_item, &iter_item_long)) {
> +				return -1;

`Py_DECREF(iter_item)` and `return -2`.

I didn't notice it last time, sorry.

> +			}
>  			Py_DECREF(iter_item);
>  			if (iter_item_long < min_idx)
>  				min_idx = iter_item_long;


More information about the Mercurial-devel mailing list