[Spice-devel] [spice-common PATCH] codegen: ptypes.py: keep attribute names in lists

Frediano Ziglio fziglio at redhat.com
Tue Jul 28 09:16:22 PDT 2015


> 
> This patch changes the type of 'valid_attributes' and
> 'attributes_with_arguments'. Both of them are list of strings.
> 
> This fixes the build for me on RHEL-6 (python-2.6.6).
> Build error is:
> 
> File "spice-common/python_modules/ptypes.py", line 67
>       'end',
>            ^
> SyntaxError: invalid syntax
> ---
>  python_modules/ptypes.py |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
> index efbe9b6..2e69318 100644
> --- a/python_modules/ptypes.py
> +++ b/python_modules/ptypes.py
> @@ -62,7 +62,7 @@ class FixedSize:
>  # other members
>  propagated_attributes=["ptr_array", "nonnull", "chunk"]
>  
> -valid_attributes={
> +valid_attributes=[
>      # embedded/appended at the end of the structure
>      'end',
>      # the C structure contains a pointer to data
> @@ -108,9 +108,9 @@ valid_attributes={
>      # for a switch this indicates that on network
>      # it will occupy always the same size (maximum size required for all
>      members)
>      'fixedsize',
> -}
> +]
>  
> -attributes_with_arguments={
> +attributes_with_arguments=[
>      'ctype',
>      'prefix',
>      'as_ptr',
> @@ -119,7 +119,7 @@ attributes_with_arguments={
>      'minor',
>      'bytes_count',
>      'virtual',
> -}
> +]
>  
>  def fix_attributes(attribute_list):
>      attrs = {}
> --
> 1.7.1
> 

Weird!

The code is slightly different however. While {'a'} is a set ['a'] is a list. Well.. perhaps could affect performances, a set is sorted/hashed. I tried and a compatible (python 2.6.6, 2.7.8 and 3.4) is set(['a']).
If you agree I can change my patch and put a Signed-off-by.

Thanks for the test,
  Frediano


More information about the Spice-devel mailing list