Opened 3 months ago

Closed 2 months ago

#28140 closed defect (fixed)

py3: progress on symbolic/expression.pyx

Reported by: jhpalmieri Owned by:
Priority: major Milestone: sage-8.9
Component: python3 Keywords:
Cc: Merged in:
Authors: John Palmieri Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: 23b22f8 (Commits) Commit: 23b22f8fd9c0c998838e48ac4300c823d5403106
Dependencies: Stopgaps:

Description

Some fixes to Python 3 doctests in symbolic/expression.pyx.

Change History (4)

comment:1 Changed 3 months ago by jhpalmieri

  • Branch set to u/jhpalmieri/py3-expression

comment:2 Changed 3 months ago by jhpalmieri

  • Commit set to 23b22f8fd9c0c998838e48ac4300c823d5403106
  • Status changed from new to needs_review

Remaining failures:

File "src/sage/symbolic/expression.pyx", line 1526, in sage.symbolic.expression.Expression.__hash__
Failed example:
    hash(SR(2^64-1)) == hash(2^64-1)
Expected:
    True
Got:
    False

Maybe this will require a pynac update.

Also I get intermittent failures which I have no idea what to do with:

File "src/sage/symbolic/expression.pyx", line 7119, in sage.symbolic.expression.Expression.gcd
Failed example:
    gcd(alg + alg*x, x^2 - 1)
Exception raised:
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/arith/misc.py", line 1771, in gcd
        return m(b, **kwargs)
      File "sage/symbolic/expression.pyx", line 7166, in sage.symbolic.expression.Expression.gcd (build/cythonized/sage/symbolic/expression.cpp:40616)
        cdef GEx x = g_gcd(self._gobj, r._gobj)
      File "sage/structure/element.pyx", line 1236, in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10816)
        return coercion_model.bin_op(left, right, add)
      File "sage/structure/coerce.pyx", line 1207, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10898)
        raise bin_op_exception(op, x, y)
    TypeError: unsupported operand parent(s) for +: 'Algebraic Real Field' and 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.symbolic.expression.Expression.gcd[14]>", line 1, in <module>
        gcd(alg + alg*x, x**Integer(2) - Integer(1))
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/arith/misc.py", line 1773, in gcd
        return m(py_scalar_to_element(b), **kwargs)
      File "sage/symbolic/expression.pyx", line 7166, in sage.symbolic.expression.Expression.gcd (build/cythonized/sage/symbolic/expression.cpp:40616)
        cdef GEx x = g_gcd(self._gobj, r._gobj)
      File "sage/structure/element.pyx", line 1236, in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10816)
        return coercion_model.bin_op(left, right, add)
      File "sage/structure/coerce.pyx", line 1207, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10898)
        raise bin_op_exception(op, x, y)
    TypeError: unsupported operand parent(s) for +: 'Algebraic Real Field' and 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I'
**********************************************************************
File "src/sage/symbolic/expression.pyx", line 7121, in sage.symbolic.expression.Expression.gcd
Failed example:
    gcd(alg - alg*x, x^2 - 1)
Exception raised:
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/arith/misc.py", line 1771, in gcd
        return m(b, **kwargs)
      File "sage/symbolic/expression.pyx", line 7166, in sage.symbolic.expression.Expression.gcd (build/cythonized/sage/symbolic/expression.cpp:40616)
        cdef GEx x = g_gcd(self._gobj, r._gobj)
      File "sage/structure/element.pyx", line 1236, in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10816)
        return coercion_model.bin_op(left, right, add)
      File "sage/structure/coerce.pyx", line 1207, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10898)
        raise bin_op_exception(op, x, y)
    TypeError: unsupported operand parent(s) for +: 'Algebraic Real Field' and 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.symbolic.expression.Expression.gcd[15]>", line 1, in <module>
        gcd(alg - alg*x, x**Integer(2) - Integer(1))
      File "/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/arith/misc.py", line 1773, in gcd
        return m(py_scalar_to_element(b), **kwargs)
      File "sage/symbolic/expression.pyx", line 7166, in sage.symbolic.expression.Expression.gcd (build/cythonized/sage/symbolic/expression.cpp:40616)
        cdef GEx x = g_gcd(self._gobj, r._gobj)
      File "sage/structure/element.pyx", line 1236, in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10816)
        return coercion_model.bin_op(left, right, add)
      File "sage/structure/coerce.pyx", line 1207, in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10898)
        raise bin_op_exception(op, x, y)
    TypeError: unsupported operand parent(s) for +: 'Algebraic Real Field' and 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I'

New commits:

23b22f8trac 28140: py3 fixes for doctest failures in symbolic/expression.pyx

comment:3 Changed 2 months ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, any progress is good to take. Thanks a lot for working on the py3 transition, John.

comment:4 Changed 2 months ago by vbraun

  • Branch changed from u/jhpalmieri/py3-expression to 23b22f8fd9c0c998838e48ac4300c823d5403106
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.