Issue #16704: Get rid of select.error in stdlib. Use OSError instead.

This commit is contained in:
Andrew Svetlov 2012-12-17 22:23:46 +02:00
parent 5ee29491e5
commit 6d8a122b9c
5 changed files with 8 additions and 8 deletions

View File

@ -1614,7 +1614,7 @@ class Popen(object):
raise TimeoutExpired(self.args, orig_timeout)
try:
ready = poller.poll(timeout)
except select.error as e:
except OSError as e:
if e.args[0] == errno.EINTR:
continue
raise
@ -1682,7 +1682,7 @@ class Popen(object):
(rlist, wlist, xlist) = \
select.select(self._read_set, self._write_set, [],
timeout)
except select.error as e:
except OSError as e:
if e.args[0] == errno.EINTR:
continue
raise

View File

@ -313,7 +313,7 @@ class Telnet:
while i < 0 and not self.eof:
try:
ready = poller.poll(call_timeout)
except select.error as e:
except OSError as e:
if e.errno == errno.EINTR:
if timeout is not None:
elapsed = time() - time_start
@ -683,7 +683,7 @@ class Telnet:
while not m and not self.eof:
try:
ready = poller.poll(call_timeout)
except select.error as e:
except OSError as e:
if e.errno == errno.EINTR:
if timeout is not None:
elapsed = time() - time_start

View File

@ -773,7 +773,7 @@ if threading:
"""
try:
asyncore.loop(poll_interval, map=self.sockmap)
except select.error:
except OSError:
# On FreeBSD 8, closing the server repeatably
# raises this error. We swallow it if the
# server has been closed.

View File

@ -32,7 +32,7 @@ class SelectTestCase(unittest.TestCase):
fp.close()
try:
select.select([fd], [], [], 0)
except select.error as err:
except OSError as err:
self.assertEqual(err.errno, errno.EBADF)
else:
self.fail("exception not raised")

View File

@ -299,10 +299,10 @@ class WakeupSignalTests(unittest.TestCase):
# We attempt to get a signal during the select call
try:
select.select([read], [], [], TIMEOUT_FULL)
except select.error:
except OSError:
pass
else:
raise Exception("select.error not raised")
raise Exception("OSError not raised")
after_time = time.time()
dt = after_time - before_time
if dt >= TIMEOUT_HALF: