Changes between Version 2 and Version 3 of Ticket #11812


Ignore:
Timestamp:
Sep 22, 2011, 2:35:50 PM (11 years ago)
Author:
Marco Streng
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11812 – Description

    v2 v3  
    33of to the file name, and give no line numbers or code snippets. This
    44makes it hard to find out where the error is.
     5
     6The patch fixes this for attach, but not for load (because of efficiency reasons).
     7
     8Apply [attachment:trac_11812-traceback_attach.patch]
    59
    610Example:
     
    5458by zero...
    5559
    56 The cause of the problem was pinpointed by Conrado PLG and he gives the following fix:
    57 
    58 Search preparser.py for {{{elif fpath.endswith('.sage')}}} and change to the code below:
    59 {{{
    60     elif fpath.endswith('.sage'):
    61         s = preparse_file(open(fpath).read())
    62         f = open(fpath + '.py', 'w')
    63         f.write(s)
    64         f.close()
    65         execfile(fpath + '.py', globals)
    66 }}}
    67 
    68 After that change, the traceback contains the information that I want:
    69 {{{
    70 /Users/marcostreng/tmp/foo.sage.py in foo()
    71      10 def foo():
    72      11      # lots of lines of code
    73      12      a = Bar()
    74 ---> 13      a.function_with_common_name()
    75      14      # lots of lines of code
    76 
    77 /Users/marcostreng/tmp/foo.sage.py in function_with_common_name(self)
    78       3      def function_with_common_name(self):
    79       4          # lots of lines of code
    80 ----> 5          _sage_const_1 /_sage_const_0
    81       6          # lots of lines of code
    82       7
    83 }}}
    84 
    85 For an explanation of why this works, and for a discussion of what would be the best way to fix this, see
     60More details:
    8661[http://groups.google.com/group/sage-devel/browse_thread/thread/761f69944e21efd4]
    87 
    88 Of course a patch should also include a doctest to prevent all this from happening again.
    89