-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create consistent method resolution order (MRO) when using filtered categories #39154
Comments
I can consistently reproduce this in a Sage session with
Evidently the issue is because the MRO are inconsistent.
Which raises the question of how the ordering of the bases are specified. in
So the question is where (result, bases) = C3_sorted_merge([cat._all_super_categories
for cat in self._super_categories] +
[self._super_categories],
category_sort_key)
if not sorted(result, key=category_sort_key, reverse=True) == result:
warn("Inconsistent sorting results for all super categories of {}".format(
self.__class__))
self._super_categories_for_classes = bases The function comes from #11943 which should be consistent with Python's MRO. Visualizing the MRO, it looks like the following MRO_of_FiniteDimensionalAlgebrasWithBasis.subcategory_class.pdf MRO_of_FilteredModulesWithBasis.FiniteDimensional.subcategory_class.pdf Maybe C3 algorithm has changed or something, but the identity specified in #11943 no longer holds:
More minimal example:
https://ncatlab.org/nlab/show/filtered+object @cached_method
def Filtered(self, base_ring=None):
r"""
Return the subcategory of the filtered objects of ``self``. So, for The problem is for some reason when the first line is included then the last line returns
Which appears to boil down to
|
Actually part of the reason why it behaves weirdly is written here
|
Steps To Reproduce
In https://github.com/tobiasdiez/sage/tree/pytest-no-isolation-bug, run
pytest --doctest src/sage/algebras/{af,ass,clifford}**.py
.(It is not necessary to really use this branch, but in it a few unrelated doctests are deleted to make investigation hopefully easier).
It's a combination of the following 3 doctests that trigger the error (but in a sage session it works well):
In particular, it works if you remove
Filtered
in the second line.(Note that pytest by default doesn't isolate doctests from each other, so the code is just run in the same process, after an initial
sage.all
import - similar to how you would run it in a linear sage terminal session.)(I'm using the meson build in a conda environment, but I doubt this makes a difference.)
Expected Behavior
Tests pass, as they do if you run
pytest --doctest src/sage/algebras --isolated
(with https://github.com/gilfree/pytest-isolate installed).Actual Behavior
Fails with
Additional Information
Similar #20460 and #20896
Does anyone has an idea how to debug this further?
Environment
Latest
Checklist
The text was updated successfully, but these errors were encountered: