mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
#30624 / selectors: use bare except clause in order to not leave the fd in a bad state in case of error (#2082)
This commit is contained in:
parent
6b6e687766
commit
05dc20f992
2 changed files with 6 additions and 2 deletions
|
@ -387,7 +387,7 @@ class _PollLikeSelector(_BaseSelectorImpl):
|
||||||
selector_events |= self._EVENT_WRITE
|
selector_events |= self._EVENT_WRITE
|
||||||
try:
|
try:
|
||||||
self._selector.modify(key.fd, selector_events)
|
self._selector.modify(key.fd, selector_events)
|
||||||
except Exception:
|
except:
|
||||||
super().unregister(fileobj)
|
super().unregister(fileobj)
|
||||||
raise
|
raise
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -524,7 +524,7 @@ if hasattr(select, 'kqueue'):
|
||||||
kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
|
kev = select.kevent(key.fd, select.KQ_FILTER_WRITE,
|
||||||
select.KQ_EV_ADD)
|
select.KQ_EV_ADD)
|
||||||
self._selector.control([kev], 0, 0)
|
self._selector.control([kev], 0, 0)
|
||||||
except Exception:
|
except:
|
||||||
super().unregister(fileobj)
|
super().unregister(fileobj)
|
||||||
raise
|
raise
|
||||||
return key
|
return key
|
||||||
|
|
|
@ -350,6 +350,10 @@ Extension Modules
|
||||||
Library
|
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
|
- 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
|
non-blocking mode if it succeeded to aquire the lock but the acquire took
|
||||||
longer than the timeout.
|
longer than the timeout.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue