diff options
Diffstat (limited to 'Lib/selectors.py')
-rw-r--r-- | Lib/selectors.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/selectors.py b/Lib/selectors.py index beb7ef7741..7b6da29863 100644 --- a/Lib/selectors.py +++ b/Lib/selectors.py @@ -445,8 +445,10 @@ if hasattr(select, 'epoll'): return ready def close(self): - self._epoll.close() - super().close() + try: + self._epoll.close() + finally: + super().close() if hasattr(select, 'kqueue'): @@ -517,8 +519,10 @@ if hasattr(select, 'kqueue'): return ready def close(self): - self._kqueue.close() - super().close() + try: + self._kqueue.close() + finally: + super().close() # Choose the best implementation: roughly, epoll|kqueue > poll > select. |