Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d50a187

Browse files
committed
Fix for two problems on FreeBSD:
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
1 parent 78430b6 commit d50a187

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_poll.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def test_poll1():
5757
buf = os.read(rd, MSG_LEN)
5858
assert len(buf) == MSG_LEN
5959
print buf
60-
os.close(r2w[rd])
60+
os.close(r2w[rd]) ; os.close( rd )
61+
p.unregister( r2w[rd] )
62+
p.unregister( rd )
6163
writers.remove(r2w[rd])
6264

6365
poll_unit_tests()
@@ -145,13 +147,14 @@ def test_poll2():
145147
fdlist = pollster.poll(tout)
146148
if (fdlist == []):
147149
continue
148-
if fdlist[0] == (p.fileno(),select.POLLHUP):
150+
fd, flags = fdlist[0]
151+
if flags & select.POLLHUP:
149152
line = p.readline()
150153
if line != "":
151154
print 'error: pipe seems to be closed, but still returns data'
152155
continue
153156

154-
elif fdlist[0] == (p.fileno(),select.POLLIN):
157+
elif flags & select.POLLIN:
155158
line = p.readline()
156159
if verbose:
157160
print `line`

0 commit comments

Comments
 (0)