[Spice-commits] python_modules/ptypes.py

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Apr 17 13:14:59 UTC 2018


 python_modules/ptypes.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 885b1a6bb9e3644e01a1d4f11376febc6145e526
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Apr 10 16:29:06 2018 -0500

    Remove extra self parameter from member function
    
    When testing out some experimental protocol changes, I managed to
    trigger the following error:
    
      GEN      generated_client_demarshallers.c
    Traceback (most recent call last):
      File "../../../spice-common/spice_codegen.py", line 267, in <module>
        demarshal.write_protocol_parser(writer, proto, True)
      File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1270, in write_protocol_parser
        parsers[channel.value] = (channel.channel_type, write_channel_parser(writer, channel.channel_type, is_server))
      File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1163, in write_channel_parser
        func = write_msg_parser(helpers, ids[i].message_type)
      File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1061, in write_msg_parser
        num_pointers = message.get_num_pointers()
      File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 855, in get_num_pointers
        count = count + m.get_num_pointers()
      File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 662, in get_num_pointers
        return self.member_type.get_num_pointers()
      File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 507, in get_num_pointers
        if self.is_constant_length(self):
    TypeError: is_constant_length() takes exactly 1 argument (2 given)
    
    Calling a member function will implicitly pass 'self' as the first
    argument, but we were also explicitly passing it as an argument
    (self.is_constant_length(self)). This resulted in the above error.
    
    Acked-by: Lukáš Hrázký <lhrazky at redhat.com>

diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index 63a7a2f..d29c97a 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -504,7 +504,7 @@ class ArrayType(Type):
         element_count = self.element_type.get_num_pointers()
         if element_count  == 0:
             return 0
-        if self.is_constant_length(self):
+        if self.is_constant_length():
             return element_count * self.size
         raise Exception("Pointers in dynamic arrays not supported")
 


More information about the Spice-commits mailing list