Martin Panter added the comment:

Thanks for the information. That narrows the problem down, but I still don’t 
exactly know why it hangs.

A good workaround may be to put a timeout in the “select” call for a second or 
so, and if it times out, raise an exception which will fail the test but let 
the rest of the tests continue. To add the timeout, I would change the code in 
“run_pty” to look like

selected = sel.select(timeout=1)
if not selected:
    raise Exception("Child timed out: remaining input {!r}, output {!r}".format(
        input, output))
for [_, events] in selected:
    ...

This is what “test_auto_history_enabled” is supposed to do:

1. Create a pseudo-terminal with master and slave file descriptors
2. Spawn a child process to read from the slave and then print the test result 
to the slave
3. Parent waits to be able to read from or write to the PTY master
4. Parent writes the bytes b"dummy input\r" to the PTY
    5. Child calls “input” which calls the Readline library and reads the input
    6. Child writes the test result to the PTY slave
7. Parent reads the output from the child
    8. Child closes its slave file descriptor and exits
9. On Linux, reading then raises EIO indicating all copies of the slave are 
closed and there is no more output left to read

The parent is hanging at step 3, before entering step 4, 7, or 9. Some input 
may already have been written to the child, and some output may have been 
captured, but it assumes the child is still running and is waiting for it to 
exit, which should close the slave file descriptor.

It would be interesting to confirm if the child has exited or is still waiting 
for the CR to terminate its input line. Or perhaps the slave file descriptor 
has somehow been duplicated in a third process without being closed.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30393>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to