Opened 5 years ago

Closed 4 years ago

#17321 closed defect (fixed)

doctest fixed Pynac RuntimeErrors

Reported by: vbraun Owned by:
Priority: major Milestone: sage-6.8
Component: symbolics Keywords:
Cc: burcin Merged in:
Authors: Ralf Stephan Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: 420af54 (Commits) Commit: 420af54c87bd9519a21656b94428d3cb9e2bad43
Dependencies: #18362 Stopgaps:

Description (last modified by rws)

Series times variable raises the following exception:

sage: ex = sin(x).series(x==0, 3) * x
sage: str(ex)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-c277618b0823> in <module>()
----> 1 str(ex)

/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject.__repr__ (build/cythonized/sage/structure/sage_object.c:1962)()

/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._repr_ (build/cythonized/sage/symbolic/expression.cpp:4749)()

/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/symbolic/ring.so in sage.symbolic.ring.SymbolicRing._repr_element_ (build/cythonized/sage/symbolic/ring.cpp:8462)()

RuntimeError: comparing typeid's

https://github.com/pynac/pynac/issues/22 https://github.com/pynac/pynac/issues/32 https://github.com/pynac/pynac/issues/33

Change History (14)

comment:1 follow-up: Changed 5 years ago by rws

I get the same(?) error in the current #7660.

sage: theta = var('theta')
sage: eqn =   (x^3 + theta < sin(x*theta))
sage: eqn/theta
<repr(<sage.symbolic.expression.Expression at 0x7f3fe34efef0>) failed: RuntimeError: comparing typeid's>

comment:2 in reply to: ↑ 1 Changed 5 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-6.4 to sage-6.7
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

Also, from comment 16 of #12967:

sage: cmp(SR(oo), sqrt(2))
RuntimeError: comparing typeid's

comment:3 Changed 5 years ago by rws

  • Dependencies set to pynac-0.3.7
  • Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, in a later stable release.

With the latest commit in Pynac we now have:

sage: ex = sin(x).series(x==0, 3) * x
sage: str(ex)
'x*(1*x + Order(x^3))'
sage: cmp(SR(oo), sqrt(2))
1
sage: bool(SR(oo) < sqrt(2))  
False
sage: bool(SR(oo) > sqrt(2))
False

This means there is no longer a runtime error, there is however still code missing in Pynac and Sage to correctly handle these requests.

Version 0, edited 5 years ago by rws (next)

comment:4 Changed 5 years ago by rws

  • Dependencies changed from pynac-0.3.7 to #18362, #12967
  • Description modified (diff)
  • Report Upstream changed from Fixed upstream, in a later stable release. to N/A

comment:5 Changed 4 years ago by rws

  • Milestone changed from sage-6.7 to sage-6.8
  • Summary changed from Pynac RuntimeError: comparing typeid's to doctest fixed Pynac RuntimeErrors

The last of the cases given in the comments is now fixed in #18877, so this ticket should doctest all related ones.

comment:6 Changed 4 years ago by rws

  • Dependencies changed from #18362, #12967 to #18362

comment:7 Changed 4 years ago by rws

Wrong, the cmp problem still remains...

sage: cmp(SR(oo), sqrt(2))
1
sage: cmp(SR(-oo), sqrt(2))
1
sage: cmp(sqrt(2), SR(oo))
1
sage: cmp(sqrt(2), SR(-oo))
1

but this is clearly #16397 so this ticket should doctest the bool fixes.

comment:8 Changed 4 years ago by rws

  • Branch set to u/rws/doctest_fixed_pynac_runtimeerrors

comment:9 Changed 4 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 522bf961b6fc9fb06b236d62568f133128fdf7f8
  • Status changed from new to needs_review

New commits:

522bf9617321: doctest fixed Pynac RuntimeErrors

comment:10 Changed 4 years ago by jdemeyer

  • Status changed from needs_review to needs_work

Please remove all those bools. You can just write assert(x > y) or assert(not x > y).

comment:11 Changed 4 years ago by git

  • Commit changed from 522bf961b6fc9fb06b236d62568f133128fdf7f8 to 420af54c87bd9519a21656b94428d3cb9e2bad43

Branch pushed to git repo; I updated commit sha1. New commits:

420af5417321: replace bool with assert in doctests

comment:12 Changed 4 years ago by rws

  • Status changed from needs_work to needs_review

comment:13 Changed 4 years ago by jdemeyer

  • Reviewers set to Jeroen Demeyer
  • Status changed from needs_review to positive_review

comment:14 Changed 4 years ago by vbraun

  • Branch changed from u/rws/doctest_fixed_pynac_runtimeerrors to 420af54c87bd9519a21656b94428d3cb9e2bad43
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.