summaryrefslogtreecommitdiffstats
path: root/Lib/selectors.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-06-10 23:51:52 (GMT)
committerGuido van Rossum <guido@python.org>2017-06-10 23:51:52 (GMT)
commit05dc20f992754c4ed2b1601026263e1f309cead9 (patch)
tree95abfaf5d471da5063c513c2facbdae58fd0b4df /Lib/selectors.py
parent6b6e68776663c0dda04b6a36609297728da2ae9e (diff)
downloadcpython-05dc20f992754c4ed2b1601026263e1f309cead9.zip
cpython-05dc20f992754c4ed2b1601026263e1f309cead9.tar.gz
cpython-05dc20f992754c4ed2b1601026263e1f309cead9.tar.bz2
#30624 / selectors: use bare except clause in order to not leave the fd in a bad state in case of error (#2082)
Diffstat (limited to 'Lib/selectors.py')
-rw-r--r--Lib/selectors.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/selectors.py b/Lib/selectors.py
index edde22c..f8b17a1 100644
--- a/Lib/selectors.py
+++ b/Lib/selectors.py
@@ -387,7 +387,7 @@ class _PollLikeSelector(_BaseSelectorImpl):
selector_events |= self._EVENT_WRITE
try:
self._selector.modify(key.fd, selector_events)
- except Exception:
+ except:
super().unregister(fileobj)
raise
changed = True
@@ -524,7 +524,7 @@ if hasattr(select, 'kqueue'):
kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
select.KQ_EV_ADD)
self._selector.control([kev], 0, 0)
- except Exception:
+ except:
super().unregister(fileobj)
raise
return key