Skip to content

Ipython bug -- the tracebacks in the sage command line list all absolute paths to Cython files totally incorrectly. #1458

@williamstein

Description

@williamstein

On the command line:

sage: 1/0
---------------------------------------------------------------------------
<type 'exceptions.ZeroDivisionError'>     Traceback (most recent call last)

/Users/was/<ipython console> in <module>()

/Users/was/element.pyx in sage.structure.element.RingElement.__div__()

/Users/was/coerce.pxi in sage.structure.element._div_c()

/Users/was/integer.pyx in sage.rings.integer.Integer._div_c_impl()

/Users/was/integer_ring.pyx in sage.rings.integer_ring.IntegerRing_class._div()

<type 'exceptions.ZeroDivisionError'>: Rational division by zero


Notice that the absolute paths are nonsense.

In the notebook:

1/0

outputs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/was/.sage/sage_notebook/worksheets/admin/9/code/5.py", line 4, in <module>
    Integer(1)/Integer(0)
  File "/Users/was/s/data/extcode/sage/", line 1, in <module>
    
  File "element.pyx", line 1480, in sage.structure.element.RingElement.__div__
  File "coerce.pxi", line 138, in sage.structure.element._div_c
  File "integer.pyx", line 854, in sage.rings.integer.Integer._div_c_impl
  File "integer_ring.pyx", line 190, in sage.rings.integer_ring.IntegerRing_class._div
ZeroDivisionError: Rational division by zero

so there are no absolute paths. This is the same as in Python itself:

>>> 1/sage.all.ZZ(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "element.pyx", line 1482, in sage.structure.element.RingElement.__div__
  File "coerce.pyx", line 252, in sage.structure.coerce.CoercionModel_cache_maps.bin_op_c
  File "element.pyx", line 1480, in sage.structure.element.RingElement.__div__
  File "coerce.pxi", line 138, in sage.structure.element._div_c
  File "integer.pyx", line 854, in sage.rings.integer.Integer._div_c_impl
  File "integer_ring.pyx", line 190, in sage.rings.integer_ring.IntegerRing_class._div
ZeroDivisionError: Rational division by zero

Component: user interface

Issue created by migration from https://trac.sagemath.org/ticket/1458

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions