Skip to content

Commit

Permalink
Trac #26878: KleshchevPartitions: ensure that _element_constructor_ i…
Browse files Browse the repository at this point in the history
…s a bound method

The `_element_constructor` machinery in `Parent` has support both for
`P._element_constructor_` being a bound and an unbound method. However,
there is exactly one case where an unbound method occurs and that is for
`KleshchevPartitions`.

It would be good to simplify the `_element_constructor` handling to
always assume a bound method, but then `KleshchevPartitions` must be
fixed.

URL: https://trac.sagemath.org/26878
Reported by: jdemeyer
Ticket author(s): Jeroen Demeyer
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager authored and vbraun committed Dec 23, 2018
2 parents cc7051e + 995ca87 commit c448fe6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sage/combinat/partition_kleshchev.py
Expand Up @@ -85,7 +85,7 @@
from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets
from sage.misc.lazy_attribute import lazy_attribute
from sage.rings.all import NN, ZZ, IntegerModRing
from sage.cpython.getattr import raw_getattr
from sage.cpython.getattr import getattr_from_other_class

from collections import defaultdict

Expand Down Expand Up @@ -1441,7 +1441,7 @@ def __init__(self, e, multicharge, convention):
self._level = len(multicharge)
if self._level == 1:
self.Element = KleshchevPartitionCrystal
self._element_constructor_ = raw_getattr(Partitions, '_element_constructor_')
self._element_constructor_ = getattr_from_other_class(self, Partitions, '_element_constructor_')
else:
self.Element = KleshchevPartitionTupleCrystal

Expand Down Expand Up @@ -1638,7 +1638,7 @@ def __init__(self, e, multicharge=(0,), size=0, convention='RS'):
self._level = len(multicharge)
if self._level == 1:
self.Element = KleshchevPartition
self._element_constructor_ = raw_getattr(Partitions, '_element_constructor_')
self._element_constructor_ = getattr_from_other_class(self, Partitions, '_element_constructor_')
else:
self.Element = KleshchevPartitionTuple
super(KleshchevPartitions_size, self).__init__(category=FiniteEnumeratedSets())
Expand Down

0 comments on commit c448fe6

Please sign in to comment.