Opened 12 years ago

Closed 10 years ago

#6801 closed defect (duplicate)

weird bug in magma.eval

Reported by: was Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: interfaces Keywords:
Cc: Merged in:
Authors: Reviewers: Mariah Lenox, Kiran Kedlaya
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This gives a weird magma error:

magma.eval("""
function t()
    a:=1+2+3+4+5+6+7+8+9+0+1+2+3+4+5+6+7+8+9+0+1+2+3+4+5+6+7+8+9+0+1+2+3+4+5+6+7+8+9+0+1+2+3+4+5+6+7;
end function;
""")

The same thing with a shorter line starting "a:=" does not fail.

Change History (6)

comment:1 Changed 12 years ago by klee

The weird error occurs because Sage try to use a file to input the second line "a:=..." when Magma is waiting for the remaining part of "function t()". Look at the following pexpect log.

function t()
>>>load "/Users/Kwankyu/.sage//temp/athena.local/72436//interface//tmp72436";
load "/Users/Kwankyu/.sage//temp/athena.local/72436//interface//tmp72436";

>> load "/Users/Kwankyu/.sage//temp/athena.local/72436//interface//tmp72436";
   ^
User error: bad syntax
>>>end function;
end function;

>> end function;
   ^
User error: bad syntax
>>>

I don't understand why the parameter "allow_use_file" is defaulted to True, in "sage/interfaces/expect.py(631)_eval_line()". See

def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True):

comment:2 Changed 12 years ago by klee

I see... A file is used if the input line is longer than self._eval_using_file_cutoff, which is 100 in my case.

comment:3 Changed 12 years ago by klee

In "sage/interfaces/magma.py(278)", the default value 100 for the parameter "eval_using_file_cutoff" is set.

        Expect.__init__(self,
                        name = "magma",
                        prompt = ">>SAGE>>",
                        command = command,
                        maxread = maxread,
                        server = server, 
                        server_tmpdir = server_tmpdir,
                        script_subdirectory = script_subdirectory,
                        restart_on_ctrlc = False,
                        logfile = logfile,
                        eval_using_file_cutoff=100)      

I think 100 is too small. Many of my own Magma codes have lines exceeding 100. Should we simply set the value to a larger value, e.g., 300? This may be a solution, though not elegant.... Is there a smarter solution? One solution is to provide a method like

magma.SetDefaultFileCutoffLength?(file_cutoff=300)

so that users can adjust it for their convenience.

comment:4 Changed 10 years ago by mariah

  • Authors set to Mariah Lenox
  • Milestone changed from sage-4.7 to sage-duplicate/invalid/wontfix
  • Report Upstream set to N/A
  • Status changed from new to needs_review

This problem no longer seems to exist with sage-4.7.rc4 and magma-2.17-7. I suggest that this ticket be closed.

comment:5 Changed 10 years ago by kedlaya

  • Status changed from needs_review to positive_review

I think this can now be regarded as a duplicate of #9705 and thus closed.

comment:6 Changed 10 years ago by jdemeyer

  • Authors Mariah Lenox deleted
  • Resolution set to duplicate
  • Reviewers set to Mariah Lenox, Kiran Kedlaya
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.