Mercurial > cpython-lru_cache-weakref
view Lib/test/test_select.py @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | d6f6a1cb7d79 |
| children | 8015c5549309 |
line wrap: on
line source
# Testing select module def test(): import select import os cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do date; sleep 3; done' p = os.popen(cmd, 'r') for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: print 'timeout =', tout rfd, wfd, xfd = select.select([p], [], [], tout) print rfd, wfd, xfd if (rfd, wfd, xfd) == ([], [], []): continue if (rfd, wfd, xfd) == ([p], [], []): line = p.readline() print `line` if not line: print 'EOF' break continue print 'Heh?' test()
