Ignore:
Timestamp:
02/11/06 13:36:43 (7 years ago)
Author:
tornaria@…
Branch:
default
Message:

[project @ patch to sage-1.0.0]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/interfaces/maxima.py

    r1 r2  
    365365        # TODO: Input and output prompts in maxima can be changed by 
    366366        # setting inchar and outchar.. 
    367         eval_using_file_cutoff = 100 
     367        eval_using_file_cutoff = 200 
    368368        self.__eval_using_file_cutoff = eval_using_file_cutoff 
    369369        Expect.__init__(self, 
     
    371371                        prompt = '\(\%i[0-9]+\)', 
    372372                        command = "maxima", 
    373                         maxread = 1,        # CRUCIAL to use less buffering for maxima (or get all kinds of hangs on OS X and 64-bit machines, etc! 
     373                        maxread = 1,    # CRUCIAL to use less buffering for maxima (or get all kinds of hangs on OS X and 64-bit machines, etc! 
    374374                        script_subdirectory = script_subdirectory, 
    375375                        restart_on_ctrlc = False, 
     
    379379                                     ], 
    380380                        logfile = logfile, 
    381                         eval_using_file_cutoff=200) 
     381                        eval_using_file_cutoff=eval_using_file_cutoff ) 
    382382        self._display2d = False 
     383 
     384    def _start(self): 
     385        # For some reason sending a single input line at startup avoids 
     386        # lots of weird timing issues when doing doctests. 
     387        Expect._start(self) 
     388        self(1)     
    383389 
    384390    # this doesn't work. 
     
    406412 
    407413    def _eval_line(self, line, reformat=True, allow_use_file=False): 
    408         line = '%s; %s; %s;'%(SAGE_START, line.rstrip().rstrip(';'), SAGE_END) 
     414        line = line.rstrip().rstrip(';') 
     415        if line == '': 
     416            return '' 
     417        line = '%s; %s; %s;'%(SAGE_START, line, SAGE_END) 
    409418        if self._expect is None: 
    410419            self._start() 
     
    822831        if n < 1: 
    823832            raise ValueError, "n (=%s) must be >= 1"%n 
    824         s = self.eval('qunit(%s)'%n).lower() 
     833        s = str(self('qunit(%s)'%n)).lower() 
    825834        r = re.compile('sqrt\(.*\)') 
    826835        s = r.sub('a', s) 
    827  
    828836        a = QuadraticField(n, 'a').gen() 
    829837        return eval(s) 
Note: See TracChangeset for help on using the changeset viewer.