Hi sage-devel,
When debuggin code that is loaded into or attached to a Sage session,
the tracebacks are not very informative: they refer to <string> instead
of to the file name, and give no line numbers or code snippets. This
makes it hard to find out where the error is.
Can this be changed or improved in any way?
Thanks,
Marco
Example:
Suppose I have some files loaded with "load" or "attach", and one of them is
====================
class Bar():
def function_with_common_name(self):
# lots of lines of code
1/0
# lots of lines of code
# other classes that also have functions named function_with_common_name
def foo():
# lots of lines of code
a = Bar()
a.function_with_common_name()
# lots of lines of code
====================
Now I do
====================
sage: foo()
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
/home/marco/<ipython console> in <module>()
/home/marco/<string> in foo()
/home/marco/<string> in function_with_common_name(self)
/usr/local/sage/sage-4.6.2/local/lib/python2.6/site-packages/sage/structure/element.so
in sage.structure.element.RingElement.__div__
(sage/structure/element.c:11981)()
/usr/local/sage/sage-4.6.2/local/lib/python2.6/site-packages/sage/rings/integer.so
in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11944)()
/usr/local/sage/sage-4.6.2/local/lib/python2.6/site-packages/sage/rings/integer_ring.so
in sage.rings.integer_ring.IntegerRing_class._div
(sage/rings/integer_ring.c:5142)()
ZeroDivisionError: Rational division by zero
====================
Then to find the bug using this traceback, I would need to search my
files to find all functions named "function_with_common_name" that are
called from functions named "foo" for a line that could cause a division
by zero...
Functions that are imported do give useful information, including line
numbers a few lines of code. I'd like to see information like this for
functions that come from loading a file.
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org