Ticket #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: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | Mariah Lenox, Kiran Kedlaya |
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
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
comment:2 Changed 4 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 4 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 2 years ago by mariah
- Status changed from new to needs_review
- Report Upstream set to N/A
- Milestone changed from sage-4.7 to sage-duplicate/invalid/wontfix
- Authors set to Mariah Lenox
This problem no longer seems to exist with sage-4.7.rc4 and magma-2.17-7. I suggest that this ticket be closed.

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.
I don't understand why the parameter "allow_use_file" is defaulted to True, in "sage/interfaces/expect.py(631)_eval_line()". See