Ticket #5467: 5467_long_input_to_Macaulay2.patch

File 5467_long_input_to_Macaulay2.patch, 1.7 KB (added by novoselt, 12 years ago)

Only this patch should be applied.

  • sage/interfaces/macaulay2.py

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1263021583 25200
    # Node ID 4c31d8a9399afcf254811c4dc4191ae8b0721dbc
    # Parent  d13eb08993c6dab3a3a0d0f52ffa333f08b7a526
    Trac 5467: bug with long input to Macaulay2.
    
    diff -r eb27a39a6df4 sage/interfaces/macaulay2.py
    a b  
    166166
    167167    def _read_in_file_command(self, filename):
    168168        """
    169         EXAMPLES:
     169        Load and *execute* the content of ``filename`` in Macaulay2.
     170       
     171        :param filename: the name of the file to be loaded and executed.
     172        :type filename: string
     173        :returns: Macaulay2 command loading and executing commands in
     174            ``filename``, that is, ``'load "filename"'``.
     175        :rtype: string
     176       
     177        TESTS::
     178               
    170179            sage: from sage.misc.misc import tmp_filename
    171180            sage: filename = tmp_filename()
    172181            sage: f = open(filename, "w")
    173             sage: f.write("Hello")
     182            sage: f.write("sage_test = 7;")
    174183            sage: f.close()
    175184            sage: command = macaulay2._read_in_file_command(filename)
    176185            sage: macaulay2.eval(command)  #optional
    177             Hello
     186            sage: macaulay2.eval("sage_test")  #optional
     187            7
    178188            sage: import os
    179189            sage: os.unlink(filename)
     190            sage: macaulay2._read_in_file_command("test")
     191            'load "test"'
     192            sage: macaulay2(10^10000) == 10^10000  #optional
     193            True
    180194        """
    181         return 'get "%s"'%filename
     195        return 'load "%s"' % filename
    182196
    183197    def __getattr__(self, attrname):
    184198        """