From be2d17baaff8f5ac5ed5c14f8088f4862aa93dee Mon Sep 17 00:00:00 2001 From: Xavier Thompson Date: Thu, 10 Dec 2020 18:17:46 +0100 Subject: [PATCH] Fix inheritance inspection for qualified cypclasses --- Cython/Compiler/PyrexTypes.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 46ccfe7c5..864c9c62c 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -4650,8 +4650,17 @@ class CypClassType(CppClassType): def is_subclass(self, other_type): if other_type.is_const_cyp_class: other_type = other_type.const_base_type + elif other_type.is_qualified_cyp_class: + other_type = other_type.qual_base_type return super(CypClassType, self).is_subclass(other_type) + def subclass_dist(self, super_type): + if super_type.is_const_cyp_class: + super_type = super_type.const_base_type + elif super_type.is_qualified_cyp_class: + super_type = super_type.qual_base_type + return super(CypClassType, self).subclass_dist(super_type) + def get_constructor(self, pos): # This is (currently) only called by new statements. # In cypclass, it means direct memory allocation: @@ -4911,6 +4920,12 @@ class QualifiedCypclassType(BaseType): return self.qual_base_type.same_as_resolved_type(other_type.qual_base_type) return 0 + def is_subclass(self, other_type): + return self.qual_base_type.is_subclass(other_type) + + def subclass_dist(self, super_type): + return self.qual_base_type.subclass_dist(super_type) + def __getattr__(self, name): return getattr(self.qual_base_type, name) -- 2.25.1