Skip to content

Commit 311aec6

Browse files
committed
Use new syntax for super hash calls
This fixes the following error with pypy 5.6.0 (2.7.12) File "../pygccxml/pygccxml/declarations/calldef.py", line 233, in __hash__ hash(self.return_type) ^ TypeError: unbound method __hash__() must be called with super instance as first argument (got free_function_t instance instead) The cpython implementation was OK with this, though the syntax is dubious. The new way of writing this is better as it clearly defines what is called in the class tree. Some of the calls may even be unnecessary, but I am leaving them as-is for the moment. Cherry-picked from the develop branch
1 parent 69e78cf commit 311aec6

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

pygccxml/declarations/calldef.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,12 @@ def __eq__(self, other):
264264

265265
def __hash__(self):
266266
if "GCC" in utils.xml_generator:
267-
return (super.__hash__(self) ^
267+
return (super(calldef_t, self).__hash__() ^
268268
hash(self.return_type) ^
269269
hash(self.demangled_name))
270270
elif "CastXML" in utils.xml_generator:
271271
# No demangled name with castxml. Use the normal name.
272-
return (super.__hash__(self) ^
272+
return (super(calldef_t, self).__hash__() ^
273273
hash(self.return_type) ^
274274
hash(self.name))
275275

pygccxml/declarations/calldef_members.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __eq__(self, other):
6464
and self.has_const == other.has_const
6565

6666
def __hash__(self):
67-
return super.__hash__(self)
67+
return super(member_calldef_t, self).__hash__()
6868

6969
@property
7070
def virtuality(self):

pygccxml/declarations/cpptypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def __eq__(self, other):
935935
and self.has_mutable == other.has_mutable
936936

937937
def __hash__(self):
938-
return super.__hash__(self)
938+
return super(type_qualifiers_t, self).__hash__()
939939

940940
def __ne__(self, other):
941941
return not self.__eq__(other)

pygccxml/declarations/enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __eq__(self, other):
4747
return self.values == other.values
4848

4949
def __hash__(self):
50-
return super.__hash__(self)
50+
return super(enumeration_t, self).__hash__(self)
5151

5252
def _get__cmp__items(self):
5353
"""implementation details"""

pygccxml/declarations/scopedef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def __eq__(self, other):
228228
# return self_decls == other_decls
229229

230230
def __hash__(self):
231-
return super.__hash__(self)
231+
return super(scopedef_t, self).__hash__()
232232

233233
def _get_declarations_impl(self):
234234
raise NotImplementedError()

pygccxml/declarations/typedef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __eq__(self, other):
4444
return self.decl_type == other.decl_type
4545

4646
def __hash__(self):
47-
return super.__hash__(self)
47+
return super(typedef_t, self).__hash__(self)
4848

4949
@property
5050
def type(self):

pygccxml/declarations/variable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __eq__(self, other):
6161
and self.bits == other.bits
6262

6363
def __hash__(self):
64-
return super.__hash__(self)
64+
return super(variable_t, self).__hash__()
6565

6666
@property
6767
def type(self):

0 commit comments

Comments
 (0)