Opened 23 months ago
Closed 21 months ago
#25927 closed defect (fixed)
steenrod.py: Python 3 fixes
Reported by:  jhpalmieri  Owned by:  

Priority:  minor  Milestone:  sage8.4 
Component:  python3  Keywords:  python3 
Cc:  chapoton  Merged in:  
Authors:  John Palmieri  Reviewers:  Frédéric Chapoton 
Report Upstream:  N/A  Work issues:  
Branch:  9d31f9a (Commits)  Commit:  9d31f9a4aa575ead7faecf7d155c4bfcbf14310b 
Dependencies:  Stopgaps: 
Description
This fixes two doctest failures with Python 3 in src/sage/algebras/steenrod/
.
This is a little progress, but there is a third failure which I do not understand:
File "src/sage/algebras/steenrod/steenrod_algebra.py", line 1069, in sage.algebras.steenrod.steenrod_algebra.SteenrodAlgebra_generic.homogeneous_component Failed example: a * A(a) # only need to convert one factor Exception raised: Traceback (most recent call last): File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage8.3.rc1/local/lib/python3.6/sitepackages/sage/categories/pushout.py", line 3985, in pushout return all(Z) File "sage/categories/functor.pyx", line 384, in sage.categories.functor.Functor.__call__ (build/cythonized/sage/categories/functor.c:3223) y = self._apply_functor(self._coerce_into_domain(x)) File "sage/categories/functor.pyx", line 299, in sage.categories.functor.Functor._coerce_into_domain (build/cythonized/sage/categories/functor.c:2865) raise TypeError("x (=%s) is not in %s" % (x, self.__domain)) TypeError: x (=None) is not in Category of rings During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage8.3.rc1/local/lib/python3.6/sitepackages/sage/doctest/forker.py", line 573, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage8.3.rc1/local/lib/python3.6/sitepackages/sage/doctest/forker.py", line 983, in compile_and_execute exec(compiled, globs) File "<doctest sage.algebras.steenrod.steenrod_algebra.SteenrodAlgebra_generic.homogeneous_component[11]>", line 1, in <module> a * A(a) # only need to convert one factor File "sage/structure/element.pyx", line 1534, in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:12223) return coercion_model.bin_op(left, right, mul) File "sage/structure/coerce.pyx", line 1172, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:9677) action = self.get_action(xp, yp, op, x, y) File "sage/structure/coerce.pyx", line 1715, in sage.structure.coerce.CoercionModel_cache_maps.get_action (build/cythonized/sage/structure/coerce.c:16847) action = self.discover_action(R, S, op, r, s) File "sage/structure/coerce.pyx", line 1871, in sage.structure.coerce.CoercionModel_cache_maps.discover_action (build/cythonized/sage/structure/coerce.c:18433) action = (<Parent>S).get_action(R, op, False, s, r) File "sage/structure/parent.pyx", line 2507, in sage.structure.parent.Parent.get_action (build/cythonized/sage/structure/parent.c:21508) action = self.discover_action(S, op, self_on_left, self_el, S_el) File "sage/structure/parent.pyx", line 2614, in sage.structure.parent.Parent.discover_action (build/cythonized/sage/structure/parent.c:22810) action = detect_element_action(self, S, self_on_left, self_el, S_el) File "sage/structure/coerce_actions.pyx", line 233, in sage.structure.coerce_actions.detect_element_action (build/cythonized/sage/structure/coerce_actions.c:5892) return (RightModuleAction if X_on_left else LeftModuleAction)(Y, X, y, x) File "sage/structure/coerce_actions.pyx", line 344, in sage.structure.coerce_actions.ModuleAction.__init__ (build/cythonized/sage/structure/coerce_actions.c:6867) if self.extended_base.base() != pushout(G, base): File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage8.3.rc1/local/lib/python3.6/sitepackages/sage/categories/pushout.py", line 3987, in pushout except CoercionException: TypeError: catching classes that do not inherit from BaseException is not allowed ********************************************************************** 1 item had failures: 1 of 19 in sage.algebras.steenrod.steenrod_algebra.SteenrodAlgebra_generic.homogeneous_component [683 tests, 1 failure, 9.21 s]
I thought that the coercion framework would allow Sage to compute the product a * A(a)
. (The setup here is that A
is a graded algebra, a
is an element in a homogeneous component of it, so a
is not an element of A
. A(a)
lives in A
and so A(a) * A(a)
makes sense. But both A(a) * a
and a * A(a)
should also make sense.)
Change History (9)
comment:1 Changed 23 months ago by
 Branch set to u/jhpalmieri/steenrodpy3
comment:2 Changed 23 months ago by
 Commit set to 52a893a6023d8a67029a20335f1a749ea65bd8cb
 Status changed from new to needs_review
comment:3 Changed 23 months ago by
thanks for trying to help.
In the change
sorted(list(A[5].basis()))
you can remove list and just use sorted. Once done, you can set to positive
By the way, for another ticket, there is with python3 a very annoying issue in these files
Killing test src/sage/homology/cell_complex.py Killing test src/sage/homology/delta_complex.py
that involve an infinite recursion error.
comment:4 Changed 23 months ago by
 Commit changed from 52a893a6023d8a67029a20335f1a749ea65bd8cb to 3138d758cdfdc8d11d1b28102669a3d51da83c10
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
3138d75  trac 25927: Python 3 fix for algebras/steenrod

comment:5 Changed 23 months ago by
 Commit changed from 3138d758cdfdc8d11d1b28102669a3d51da83c10 to 9d31f9a4aa575ead7faecf7d155c4bfcbf14310b
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
9d31f9a  trac 25927: Python 3 fix for algebras/steenrod

comment:6 Changed 23 months ago by
 Reviewers set to Frédéric Chapoton
 Status changed from needs_review to positive_review
comment:7 Changed 23 months ago by
I will take a look at homology
.
comment:8 Changed 23 months ago by
 Component changed from algebra to python3
comment:9 Changed 21 months ago by
 Branch changed from u/jhpalmieri/steenrodpy3 to 9d31f9a4aa575ead7faecf7d155c4bfcbf14310b
 Resolution set to fixed
 Status changed from positive_review to closed
If we can fix the coercion problem here, that's great. We can also defer that to another ticket and do the easy fixes right away. So I'm marking this as "needs review".
New commits:
trac 25927: Python 3 fix for algebras/steenrod