Opened 17 months ago

Last modified 3 months ago

#32147 new defect

Make sage.interfaces.expect compatible with ptyprocess >= 0.5.2

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.8
Component: interfaces Keywords:
Cc: Antonio Rojas, Isuru Fernando, François Bissey, Dima Pasechnik, Michael Orlitzky Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Attachments (1)

ptyprocess-failures.txt (446.4 KB) - added by Matthias Köppe 10 months ago.

Download all attachments as: .zip

Change History (10)

comment:2 Changed 17 months ago by Matthias Köppe

Just catching PtyProcessError in addition to ExceptionPexpect on our side does not seem to fix the problem.

comment:3 Changed 17 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:4 Changed 13 months ago by Matthias Köppe

Cc: Michael Orlitzky added

comment:5 Changed 12 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:6 Changed 10 months ago by Gonzalo Tornaría

Just to mention that I've been using system ptyprocess-0.7.0 (via #29665) for a few weeks without any issue.

What's the exact issue? I haven't seen any report of what goes wrong on macos when using an updated ptyprocess.

comment:7 Changed 10 months ago by Matthias Köppe

It looks like this:

$ ./sage -pip install -U ptyprocess
Requirement already satisfied: ptyprocess in ./local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages (0.5.1)
Collecting ptyprocess
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Installing collected packages: ptyprocess
  Attempting uninstall: ptyprocess
    Found existing installation: ptyprocess 0.5.1
    Uninstalling ptyprocess-0.5.1:
      Successfully uninstalled ptyprocess-0.5.1
Successfully installed ptyprocess-0.7.0
egret:~/s/sage/sage-rebasing/worktree-gcc11 (mkoeppe-9.5.beta9+updates $%>)$ ./sage -tp src/sage/interfaces/
too many failed tests, not using stored timings
Running doctests with ID 2022-01-19-10-06-35-c84011cc.
Using --optional=build,ccache,cryptominisat,debugpy,e_antic,homebrew,igraph,jupymake,normaliz,pip,pycryptosat,pynormaliz,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Sorting sources by runtime so that slower doctests are run first....
Doctesting 61 files using 8 threads.
sage -t --random-seed=87883514352856014297393615604236705289 src/sage/interfaces/gap.py
**********************************************************************
File "src/sage/interfaces/gap.py", line 644, in sage.interfaces.gap.Gap_generic._eval_line
Failed example:
    a = gap(3)
Exception raised:
    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 511, in _execute_line
        E.sendline(line)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 578, in sendline
        return self.send(s + self.linesep)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 569, in send
        return os.write(self.child_fd, b)
    OSError: [Errno 5] Input/output error

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 658, in _eval_line
        (normal, error) = self._execute_line(line, wait_for_prompt=wait_for_prompt,
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 513, in _execute_line
        raise RuntimeError("Error evaluating %s in %s"%(line, self))
    RuntimeError: Error evaluating \$sage7:=3;; in Gap

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 1166, in _start
        Expect._start(self, "Failed to start GAP.")
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 444, in _start
        self.quit()  # in case one is already running
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 626, in quit
        self._close()
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 558, in _close
        self._expect.close(force=force)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 328, in close
        self.ptyproc.close(force=force)
      File "sage/interfaces/sagespawn.pyx", line 204, in sage.interfaces.sagespawn.SagePtyProcess.close (build/cythonized/sage/interfaces/sagespawn.c:3268)
        self.fileobj.close()
    OSError: [Errno 5] Input/output error

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 1470, in __init__
        self._name = parent._create(value, name=name)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/interface.py", line 513, in _create
        self.set(name, value)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 1328, in set
        self._eval_line(cmd, allow_use_file=True)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 701, in _eval_line
        self._start()
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/gap.py", line 1170, in _start
        self.quit()
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 626, in quit
        self._close()
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 558, in _close
        self._expect.close(force=force)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/pexpect/pty_spawn.py", line 328, in close
        self.ptyproc.close(force=force)
      File "sage/interfaces/sagespawn.pyx", line 201, in sage.interfaces.sagespawn.SagePtyProcess.close (build/cythonized/sage/interfaces/sagespawn.c:3177)
        self.write(str_to_bytes(self.quit_string))
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/ptyprocess/ptyprocess.py", line 568, in write
        return self._writeb(s, flush=flush)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/ptyprocess/ptyprocess.py", line 558, in _writeb
        n = self.fileobj.write(b)
    ValueError: write to closed file

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.gap.Gap_generic._eval_line[8]>", line 1, in <module>
        a = gap(Integer(3))
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/interface.py", line 302, in __call__
        result = self._coerce_from_special_method(x)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/interface.py", line 330, in _coerce_from_special_method
        return (x.__getattribute__(s))(self)
      File "sage/structure/sage_object.pyx", line 718, in sage.structure.sage_object.SageObject._gap_ (build/cythonized/sage/structure/sage_object.c:6249)
        return self._interface_(G)
      File "sage/structure/sage_object.pyx", line 694, in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:5783)
        X = I(s)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/interface.py", line 295, in __call__
        return cls(self, x, name=name)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/interfaces/expect.py", line 1475, in __init__
        raise TypeError(*x.args)
    TypeError: write to closed file
[......]
----------------------------------------------------------------------
sage -t --random-seed=87883514352856014297393615604236705289 src/sage/interfaces/gap.py  # 69 doctests failed
sage -t --random-seed=87883514352856014297393615604236705289 src/sage/interfaces/mwrank.py  # 6 doctests failed
sage -t --random-seed=87883514352856014297393615604236705289 src/sage/interfaces/expect.py  # 40 doctests failed
sage -t --random-seed=87883514352856014297393615604236705289 src/sage/interfaces/quit.py  # 4 doctests failed
----------------------------------------------------------------------
Total time for all tests: 39.7 seconds
    cpu time: 42.7 seconds
    cumulative wall time: 130.5 seconds
Features detected for doctesting: 

Changed 10 months ago by Matthias Köppe

Attachment: ptyprocess-failures.txt added

comment:8 Changed 9 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:9 Changed 3 months ago by Matthias Köppe

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.