]> granicus.if.org Git - python/commitdiff
Fix for two problems on FreeBSD:
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 29 Aug 2000 16:53:34 +0000 (16:53 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 29 Aug 2000 16:53:34 +0000 (16:53 +0000)
In test_poll1(), unregister file descriptors as they're closed,
    and also close the read end of the pipe
In test_poll2(), make the code assume less about the combinations of flag
    bits that will be returned

Lib/test/test_poll.py

index 543dc6bc48bf0b3364bae41bef1267dbaa41f553..82d8372be2e942e7a3b1d18b7cd75d4dd8df628d 100644 (file)
@@ -57,7 +57,9 @@ def test_poll1():
         buf = os.read(rd, MSG_LEN)
         assert len(buf) == MSG_LEN
         print buf
-        os.close(r2w[rd])
+        os.close(r2w[rd]) ; os.close( rd )
+        p.unregister( r2w[rd] )
+        p.unregister( rd )
         writers.remove(r2w[rd])
 
     poll_unit_tests()
@@ -145,13 +147,14 @@ def test_poll2():
         fdlist = pollster.poll(tout)
         if (fdlist == []):
             continue
-        if fdlist[0] == (p.fileno(),select.POLLHUP):
+        fd, flags = fdlist[0]
+        if flags & select.POLLHUP:
             line = p.readline()
             if line != "":
                 print 'error: pipe seems to be closed, but still returns data'
             continue
 
-        elif fdlist[0] == (p.fileno(),select.POLLIN):
+        elif flags & select.POLLIN:
             line = p.readline()
             if verbose:
                 print `line`