Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit a221133

Browse files
simon-king-jenaMatthias Koeppe
authored and
Matthias Koeppe
committedJul 8, 2020
fix failing doctests

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed
 

‎src/sage/algebras/letterplace/free_algebra_letterplace.pyx

+2-4
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ cdef class FreeAlgebra_letterplace(Algebra):
252252
varnames = R.variable_names()[:-1]
253253
self._nb_slackvars = 1
254254
base_ring = R.base_ring()
255-
Algebra.__init__(self, base_ring, varnames,
256-
normalize=False, category=Algebras(base_ring))
257255
self._commutative_ring = R
258256
self._current_ring = make_letterplace_ring(R,1)
259257
self._degbound = 1
@@ -264,8 +262,8 @@ cdef class FreeAlgebra_letterplace(Algebra):
264262
raise TypeError("The generator degrees must be given by a list or tuple of %d positive integers" % (self.__ngens-1))
265263
self._degrees = tuple([int(i) for i in degrees])
266264
self.set_degbound(max(self._degrees))
267-
self._populate_coercion_lists_(coerce_list=[base_ring])
268-
265+
Algebra.__init__(self, base_ring, varnames,
266+
normalize=False, category=Algebras(base_ring))
269267
def __reduce__(self):
270268
"""
271269
TESTS::

‎src/sage/categories/pushout.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -3660,10 +3660,14 @@ def pushout(R, S):
36603660
[1 2 0]
36613661
[0 0 1]
36623662
3663-
Some more tests with ``coercion_reversed = True``::
3663+
Here are some more tests with ``coercion_reversed = True``. Note that
3664+
in the following test, we are not inheriting from ``type(QQ['x'])``,
3665+
since this already inherits from a category's parent class: If this
3666+
is the case for a class, the the category framework will not be correctly
3667+
initialised for instances of this class. ::
36643668
36653669
sage: from sage.categories.pushout import ConstructionFunctor
3666-
sage: class EvenPolynomialRing(type(QQ['x'])):
3670+
sage: class EvenPolynomialRing(type(QQ['x']).__base__):
36673671
....: def __init__(self, base, var):
36683672
....: super(EvenPolynomialRing, self).__init__(base, var)
36693673
....: self.register_embedding(base[var])

‎src/sage/structure/parent.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,12 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
344344
# this calls __init_extra__ if it is *defined* in cls (not in a super class)
345345
if "__init_extra__" in cls.__dict__:
346346
cls.__init_extra__(self)
347-
if not ((category is None) or isinstance(self, category.parent_class)):
347+
if category is not None:
348348
# This is the case if and only if self is an instance of an
349349
# extension class. Now, we should go up the class hierarchy
350350
# of the category's parent class and seek for "__init_extra__".
351351
for cls in category.parent_class.mro():
352-
if "__init_extra__" in cls.__dict__:
352+
if not isinstance(self, cls) and "__init_extra__" in cls.__dict__:
353353
getattr_from_other_class(self, cls, '__init_extra__')()
354354

355355
def _init_category_(self, category):

0 commit comments

Comments
 (0)
This repository has been archived.