Re: [sage-devel] Better tracebacks (#71)
Let me also mention that I have no plans to change anything regarding the "inspect" module, this is only about displaying tracebacks. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] Better tracebacks (#71)
I don't see any big problems with the overall approach at first glance. And the result is great! David On Thu, Nov 20, 2014 at 10:45 PM, Jeroen Demeyer wrote: > Hello, > > I have a working proof-of-concept to improve tracebacks for preparsed code > and for Cython code. On http://trac.sagemath.org/ticket/71, you can see an > example of a new traceback. > > This isn't a finished patch yet, but I would like some opinions on the > general approach first. > > > The main changes are: > 1) Change the preparser to add the unpreparsed source as comments. Yes, this > increases the size of preparsed code a lot: > > sage: preparse('2 + 3') > 'Integer(2) + Integer(3) #sage_pp#:2 + 3' > > 2) When executing load() or attach(), always save the preparsed source to a > temporary file. This is needed to get any traceback at all for this exec()ed > code. > > 3) Add an upstream patch to IPython (which is likely to be accepted > upstream, I asked ipython-dev) to not replace the .pyx file by the .so file > in tracebacks. > > 4) Write a custom extract_tb() function which undoes preparsing in > tracebacks and which makes paths absolute w.r.t. SAGE_SRC. The latter is > needed because Cython filenames in tracebacks are relative. > > 5) Monkey-patch the Python library function traceback.extract_tb() with this > custom function when the SageTerminalApp starts. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Better tracebacks (#71)
Hello, I have a working proof-of-concept to improve tracebacks for preparsed code and for Cython code. On http://trac.sagemath.org/ticket/71, you can see an example of a new traceback. This isn't a finished patch yet, but I would like some opinions on the general approach first. The main changes are: 1) Change the preparser to add the unpreparsed source as comments. Yes, this increases the size of preparsed code a lot: sage: preparse('2 + 3') 'Integer(2) + Integer(3) #sage_pp#:2 + 3' 2) When executing load() or attach(), always save the preparsed source to a temporary file. This is needed to get any traceback at all for this exec()ed code. 3) Add an upstream patch to IPython (which is likely to be accepted upstream, I asked ipython-dev) to not replace the .pyx file by the .so file in tracebacks. 4) Write a custom extract_tb() function which undoes preparsing in tracebacks and which makes paths absolute w.r.t. SAGE_SRC. The latter is needed because Cython filenames in tracebacks are relative. 5) Monkey-patch the Python library function traceback.extract_tb() with this custom function when the SageTerminalApp starts. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.