id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
21895 Better metaclass inference in dynamic classes saraedum "When creating a dynamic class, (e.g., when creating an object in a category,) the following code is used to figure out the metaclass:
{{{
metaclass = DynamicMetaclass
# The metaclass of a class must derive from the metaclasses of its
# bases. The following handles the case where one of the base
# classes is a known Sage metaclass. This approach won't scale
# well if we start using metaclasses seriously in Sage.
for base in bases:
if isinstance(base, InheritComparisonClasscallMetaclass):
metaclass = DynamicInheritComparisonClasscallMetaclass
elif isinstance(base, ClasscallMetaclass):
metaclass = DynamicClasscallMetaclass
elif isinstance(base, InheritComparisonMetaclass):
metaclass = DynamicInheritComparisonMetaclass
}}}
This does not work if two bases have conflicting metaclasses, say `InheritComparisonMetaclass` and `ClasscallMetaclass`. As a result, one can currently not let a subclass of `Morphism` (which is a `InheritComparisonMetaclass`) inherit from `UniqueRepresentation` (a `ClasscallMetaclass`)." defect closed major sage-7.5 categories fixed metaclass nthiery roed Julian Rüth Jeroen Demeyer N/A 86b4868e9deb41940e3bed2a3289276bd7557a52 86b4868e9deb41940e3bed2a3289276bd7557a52