Ticket #5929: trac_5929-fix_outofsync_hang.patch

File trac_5929-fix_outofsync_hang.patch, 1.3 KB (added by tornaria, 10 years ago)

fix (workaround) for out of sync hang which timeouts a doctest

  • sage/interfaces/maxima.py

    # HG changeset patch
    # User Gonzalo Tornaría <tornaria@math.utexas.edu>
    # Date 1242012424 10800
    # Node ID 450d4e9561fbcda01a43d2e4284e814b69af2b10
    # Parent  0c69ab73bb1462300d850145629ae67928e9866b
    For #5929: fix timeout in maxima/ecl due to out-of-synch condition
    This is triggered by the following doctest
    sage: maxima._sendstr('1/1'*500)
    sage: maxima('2+2')
    In fact, the first line is missing a semicolon, so maxima is stuck out
    of synch; the synchronization code is run for the second line, and
    after a timeout, it tries to break by sending a ctrl-c (this happens
    in Expect._interrupt()), but ctrl-c is broken with ecl, so this hangs.
    The current fix adds an explicit semicolon to the synchronization
    code. This fixes the timeout in the above doctest. The hang is still
    latent, because there seems to be no way to interrupt maxima/ecl.
    diff -r 0c69ab73bb14 -r 450d4e9561fb sage/interfaces/maxima.py
    a b  
    755755        if self._expect is None: return
    756756        r = randrange(2147483647)
    757757        s = marker + str(r+1)
    758         cmd = '''sconcat("%s",(%s+1));\n'''%(marker,r)
     758        cmd = ''';sconcat("%s",(%s+1));\n'''%(marker,r)
    759759        self._sendstr(cmd)
    760760        try:
    761761            self._expect_expr(timeout=0.5)