Kaydet (Commit) 6d8a122b authored tarafından Andrew Svetlov's avatar Andrew Svetlov

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

üst 5ee29491
...@@ -1614,7 +1614,7 @@ class Popen(object): ...@@ -1614,7 +1614,7 @@ class Popen(object):
raise TimeoutExpired(self.args, orig_timeout) raise TimeoutExpired(self.args, orig_timeout)
try: try:
ready = poller.poll(timeout) ready = poller.poll(timeout)
except select.error as e: except OSError as e:
if e.args[0] == errno.EINTR: if e.args[0] == errno.EINTR:
continue continue
raise raise
...@@ -1682,7 +1682,7 @@ class Popen(object): ...@@ -1682,7 +1682,7 @@ class Popen(object):
(rlist, wlist, xlist) = \ (rlist, wlist, xlist) = \
select.select(self._read_set, self._write_set, [], select.select(self._read_set, self._write_set, [],
timeout) timeout)
except select.error as e: except OSError as e:
if e.args[0] == errno.EINTR: if e.args[0] == errno.EINTR:
continue continue
raise raise
......
...@@ -313,7 +313,7 @@ class Telnet: ...@@ -313,7 +313,7 @@ class Telnet:
while i < 0 and not self.eof: while i < 0 and not self.eof:
try: try:
ready = poller.poll(call_timeout) ready = poller.poll(call_timeout)
except select.error as e: except OSError as e:
if e.errno == errno.EINTR: if e.errno == errno.EINTR:
if timeout is not None: if timeout is not None:
elapsed = time() - time_start elapsed = time() - time_start
...@@ -683,7 +683,7 @@ class Telnet: ...@@ -683,7 +683,7 @@ class Telnet:
while not m and not self.eof: while not m and not self.eof:
try: try:
ready = poller.poll(call_timeout) ready = poller.poll(call_timeout)
except select.error as e: except OSError as e:
if e.errno == errno.EINTR: if e.errno == errno.EINTR:
if timeout is not None: if timeout is not None:
elapsed = time() - time_start elapsed = time() - time_start
......
...@@ -773,7 +773,7 @@ if threading: ...@@ -773,7 +773,7 @@ if threading:
""" """
try: try:
asyncore.loop(poll_interval, map=self.sockmap) asyncore.loop(poll_interval, map=self.sockmap)
except select.error: except OSError:
# On FreeBSD 8, closing the server repeatably # On FreeBSD 8, closing the server repeatably
# raises this error. We swallow it if the # raises this error. We swallow it if the
# server has been closed. # server has been closed.
......
...@@ -32,7 +32,7 @@ class SelectTestCase(unittest.TestCase): ...@@ -32,7 +32,7 @@ class SelectTestCase(unittest.TestCase):
fp.close() fp.close()
try: try:
select.select([fd], [], [], 0) select.select([fd], [], [], 0)
except select.error as err: except OSError as err:
self.assertEqual(err.errno, errno.EBADF) self.assertEqual(err.errno, errno.EBADF)
else: else:
self.fail("exception not raised") self.fail("exception not raised")
......
...@@ -299,10 +299,10 @@ class WakeupSignalTests(unittest.TestCase): ...@@ -299,10 +299,10 @@ class WakeupSignalTests(unittest.TestCase):
# We attempt to get a signal during the select call # We attempt to get a signal during the select call
try: try:
select.select([read], [], [], TIMEOUT_FULL) select.select([read], [], [], TIMEOUT_FULL)
except select.error: except OSError:
pass pass
else: else:
raise Exception("select.error not raised") raise Exception("OSError not raised")
after_time = time.time() after_time = time.time()
dt = after_time - before_time dt = after_time - before_time
if dt >= TIMEOUT_HALF: if dt >= TIMEOUT_HALF:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment