Ticket #4975: trac_4975-2.patch

File trac_4975-2.patch, 1.0 KB (added by mhansen, 14 months ago)
  • sage-preparse

    # HG changeset patch
    # User Mike Hansen <mhansen@gmail.com>
    # Date 1232362596 28800
    # Node ID c9defd092eced2edf36979b11d4f738d0da46986
    # Parent  bc35da7a04ebbed6ad516372ab159b4e9f4f8cb1
    Fix #4975
    
    diff -r bc35da7a04eb -r c9defd092ece sage-preparse
    a b  
    102102    # Put the Sage library include along with a autogen message in the file. 
    103103    # It is ** critical ** that we put this after the mdoule docstring, since 
    104104    # otherwise the module docstring will disappear.  
    105     insert = '%s%s%s.\nfrom sage.all_cmdline import *   # import sage library\n'%(coding, AUTOGEN_MSG, f) 
     105    insert = '%s%s.\nfrom sage.all_cmdline import *   # import sage library\n'%(AUTOGEN_MSG, f) 
    106106    i = find_position_right_after_module_docstring(G) 
    107     G = G[:i] + insert + G[i:] 
     107    G = coding + G[:i] + insert + G[i:] 
    108108 
    109109    # Finally, write out the result. 
    110110    open(fname, 'w').write(G)