Re: [PATCH 3/5] pylibfdt: Fix comparison of return value.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Jul 12, 2018 at 04:10:43PM +0200, frenzy@xxxxxxxxx wrote:
> From: Lumir Balhar <lbalhar@xxxxxxxxxx>
> 
> In Python 2, an empty list is always higher than zero but in
> Python 3 these types cannot be compared.

It would be helpful to add in the commit message what the case is
where this is passed a non-integer value.

> 
> Signed-off-by: Lumir Balhar <lbalhar@xxxxxxxxxx>
> ---
>  pylibfdt/libfdt.i | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
> index 88d443d..9c0dcdc 100644
> --- a/pylibfdt/libfdt.i
> +++ b/pylibfdt/libfdt.i
> @@ -124,7 +124,7 @@ def check_err(val, quiet=()):
>      Raises
>          FdtException if val < 0
>      """
> -    if val < 0:
> +    if isinstance(val, int) and val < 0:
>          if -val not in quiet:
>              raise FdtException(val)
>      return val

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux