Ticket #2171: sage-trac2171-part2.patch

File sage-trac2171-part2.patch, 2.6 KB (added by William Stein, 14 years ago)
  • sage/interfaces/expect.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1224818339 25200
    # Node ID ca698143915dd2418a4bb0473ea8cf01711963e0
    # Parent  052c08ccac80b0e102df5ab8fa735fb64df31b9a
    trac #2171 -- (magma/sage interface) some further optimizations and fixes (part 2)
    
    diff -r 052c08ccac80 -r ca698143915d sage/interfaces/expect.py
    a b  
    10871087        return self.eval(var)
    10881088
    10891089    def get_using_file(self, var):
    1090         """
    1091         Return the string representation of the variable var in self
    1092         using a file.  Use this if var has a huge string
    1093         representation.  It'll be way faster.
     1090        r"""
     1091        Return the string representation of the variable var in self,
     1092        possibly using a file.  Use this if var has a huge string
     1093        representation, since it may be way faster.
     1094
     1095        WARNING: In fact unless a special derived class implements
     1096        this, it will \emph{not} be any faster.  This is the case for
     1097        this class if you're reading it through introspection and
     1098        seeing this.
    10941099        """
    10951100        return self.get(var)
    10961101
  • sage/interfaces/magma.py

    diff -r 052c08ccac80 -r ca698143915d sage/interfaces/magma.py
    a b  
    11581158            [1 2 3]
    11591159            [4 5 6]
    11601160        """
    1161         P = self._check_valid()
    1162         cmd = "Sage(%s)"%self.name()
    1163         s = str(P.eval(cmd))
    1164         return sage.misc.sage_eval.sage_eval(s)
     1161        z, preparse = self.Sage(nvals = 2)
     1162        s = str(z)
     1163        preparse =  str(preparse) == 'true'
     1164        return sage.misc.sage_eval.sage_eval(s, preparse=preparse)
    11651165
    11661166    def AssignNames(self, names):
    11671167        """
  • sage/misc/sage_eval.py

    diff -r 052c08ccac80 -r ca698143915d sage/misc/sage_eval.py
    a b  
    1919    Sage.  This means calling eval after preparsing and with
    2020    globals equal to everything included in the scope of
    2121    \code{from sage.all import *}.).
     22
     23    INPUT:
     24        source -- a string or object with a _sage_ method
     25        locals -- evaluate in namespace of sage.all plus the
     26                  locals dictionary
     27        cmds   -- string; sequence of commands to be run before
     28                  source is evaluated.
     29        preparse -- (default: True) if True, preparse the
     30                  string expression.
     31   
    2232
    2333    EXAMPLES:
    2434    This example illustrates that preparsing is applied.