From: Giampaolo Rodola Date: Sat, 10 Jun 2017 23:51:52 +0000 (+0200) Subject: #30624 / selectors: use bare except clause in order to not leave the fd in a bad... X-Git-Tag: v3.7.0a1~633 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=05dc20f992754c4ed2b1601026263e1f309cead9;p=thirdparty%2FPython%2Fcpython.git #30624 / selectors: use bare except clause in order to not leave the fd in a bad state in case of error (#2082) --- diff --git a/Lib/selectors.py b/Lib/selectors.py index edde22c634b0..f8b17a14f944 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 diff --git a/Misc/NEWS b/Misc/NEWS index 20cea471a663..33333260311f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -350,6 +350,10 @@ Extension Modules Library ------- +- bpo-30624: selectors does not take KeyboardInterrupt and SystemExit into + account, leaving a fd in a bad state in case of error. Patch by Giampaolo + Rodola'. + - bpo-30595: multiprocessing.Queue.get() with a timeout now polls its reader in non-blocking mode if it succeeded to aquire the lock but the acquire took longer than the timeout.