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

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



Hi,

On 12 July 2018 at 19:01, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 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.

I suspect this is next_node(). It looks like I added this in without
noticing that check_err() is not correct in this case. It is not
designed to be called with a list.

If that is the culprit, can we instead change next_node() to call
check_err the first item of the tuple?

>
>>
>> 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

Regards,
Simon
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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