Quoting Rafael Antognolli (2017-04-07 09:52:16)
> If the 'dwords' dict is empty, max(dwords.keys()) throws an exception.
> This case could happen when we have an instruction that is only an array
> of other structs, with variable length.
> 
> Signed-off-by: Rafael Antognolli <rafael.antogno...@intel.com>
> ---
>  src/intel/genxml/gen_pack_header.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/intel/genxml/gen_pack_header.py 
> b/src/intel/genxml/gen_pack_header.py
> index 2a70945..95215a1 100644
> --- a/src/intel/genxml/gen_pack_header.py
> +++ b/src/intel/genxml/gen_pack_header.py
> @@ -357,7 +357,7 @@ class Group(object):
>          if self.size > 0:
>              length = self.size // 32
>          else:
> -            length = max(dwords.keys()) + 1
> +            length = max(dwords.keys() + [0]) + 1
I'm not sure this is the right way to solve this, for one it wont work in
python3 because in python3 dict.keys() returns an iterator instead of a list,
and adding a dict_keys iterator and a list isn't valid either.

I think the right thing to do is:

if self.size > 0:
    length = ...
elif dwords:
    length = max(dwords.keys()) + 1
else:
    length = 1

This will only got down the max path if dwords is non-empty.

Dylan

>  
>          for index in range(length):
>              # Handle MBZ dwords
> 
> base-commit: 115e6847920bfe4e2f2d542d947212a2aeae5db7
> -- 
> git-series 0.9.1
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Attachment: signature.asc
Description: signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to