Skip to content

Commit 6d8a122

Browse files
committed
Issue #16704: Get rid of select.error in stdlib. Use OSError instead.
1 parent 5ee2949 commit 6d8a122

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/subprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ def close_unregister_and_remove(fd):
16141614
raise TimeoutExpired(self.args, orig_timeout)
16151615
try:
16161616
ready = poller.poll(timeout)
1617-
except select.error as e:
1617+
except OSError as e:
16181618
if e.args[0] == errno.EINTR:
16191619
continue
16201620
raise
@@ -1682,7 +1682,7 @@ def _communicate_with_select(self, input, endtime, orig_timeout):
16821682
(rlist, wlist, xlist) = \
16831683
select.select(self._read_set, self._write_set, [],
16841684
timeout)
1685-
except select.error as e:
1685+
except OSError as e:
16861686
if e.args[0] == errno.EINTR:
16871687
continue
16881688
raise

Lib/telnetlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def _read_until_with_poll(self, match, timeout):
313313
while i < 0 and not self.eof:
314314
try:
315315
ready = poller.poll(call_timeout)
316-
except select.error as e:
316+
except OSError as e:
317317
if e.errno == errno.EINTR:
318318
if timeout is not None:
319319
elapsed = time() - time_start
@@ -683,7 +683,7 @@ def _expect_with_poll(self, expect_list, timeout=None):
683683
while not m and not self.eof:
684684
try:
685685
ready = poller.poll(call_timeout)
686-
except select.error as e:
686+
except OSError as e:
687687
if e.errno == errno.EINTR:
688688
if timeout is not None:
689689
elapsed = time() - time_start

Lib/test/test_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def serve_forever(self, poll_interval):
773773
"""
774774
try:
775775
asyncore.loop(poll_interval, map=self.sockmap)
776-
except select.error:
776+
except OSError:
777777
# On FreeBSD 8, closing the server repeatably
778778
# raises this error. We swallow it if the
779779
# server has been closed.

Lib/test/test_select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_errno(self):
3232
fp.close()
3333
try:
3434
select.select([fd], [], [], 0)
35-
except select.error as err:
35+
except OSError as err:
3636
self.assertEqual(err.errno, errno.EBADF)
3737
else:
3838
self.fail("exception not raised")

Lib/test/test_signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ def test_wakeup_fd_during(self):
299299
# We attempt to get a signal during the select call
300300
try:
301301
select.select([read], [], [], TIMEOUT_FULL)
302-
except select.error:
302+
except OSError:
303303
pass
304304
else:
305-
raise Exception("select.error not raised")
305+
raise Exception("OSError not raised")
306306
after_time = time.time()
307307
dt = after_time - before_time
308308
if dt >= TIMEOUT_HALF:

0 commit comments

Comments
 (0)