classification
Title: selectors should use bare except clauses
Type: Stage: resolved
Components: asyncio Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mariatta, berker.peksag, giampaolo.rodola, gvanrossum, neologix, serhiy.storchaka, vstinner, yselivanov
Priority: normal Keywords:

Created on 2017-06-10 18:11 by giampaolo.rodola, last changed 2017-06-12 12:52 by giampaolo.rodola. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2082 merged giampaolo.rodola, 2017-06-10 18:15
PR 2108 merged giampaolo.rodola, 2017-06-11 12:06
Messages (8)
msg295648 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2017-06-10 18:11
Right now it uses "except Exception: ...; raise" which does not take KeyboardInterrupt and SystemExit into account, leaving the fd in a bad state (it's not unregister()ed).
msg295682 - (view) Author: Mariatta Wijaya (Mariatta) * (Python committer) Date: 2017-06-11 03:12
I removed 3.4 from versions, since this is not a security fix.

Does this need backport to 3.5 too? 
Or only 3.6?
msg295685 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-11 03:46
Look also at KqueueSelector.modify(). And the mentioning of SystemError in Misc/NEWS is wrong, it is a subclass of Exception.
msg295699 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-11 10:15
Serhiy Storchaka added the comment:

Look also at KqueueSelector.modify(). And the mentioning of SystemError in
Misc/NEWS is wrong, it is a subclass of Exception.

I guess that he means SystemExit ;-)
msg295701 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-11 10:26
My apologies. The Misc/NEWS entry is correct. But only 2 of 3 "except Exception" are fixed.
msg295706 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2017-06-11 12:07
> But only 2 of 3 "except Exception" are fixed.

My bad. New PR:
https://github.com/python/cpython/pull/2108
msg295772 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2017-06-12 12:43
New changeset ced36a993fcfd1c76637119d31c03156a8772e11 by Giampaolo Rodola in branch 'master':
bpo-30624 remaining bare except (#2108)
https://github.com/python/cpython/commit/ced36a993fcfd1c76637119d31c03156a8772e11
msg295773 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2017-06-12 12:52
I see that on 3.6 except BaseException: is used, so the backport should not be necessary.
History
Date User Action Args
2017-06-12 12:52:28giampaolo.rodolasetstatus: open -> closed
versions: - Python 3.5, Python 3.6
messages: + msg295773

resolution: fixed
stage: backport needed -> resolved
2017-06-12 12:43:42giampaolo.rodolasetmessages: + msg295772
2017-06-11 12:07:22giampaolo.rodolasetmessages: + msg295706
2017-06-11 12:06:52giampaolo.rodolasetpull_requests: + pull_request2161
2017-06-11 10:26:36serhiy.storchakasetmessages: + msg295701
2017-06-11 10:15:23vstinnersetmessages: + msg295699
2017-06-11 03:46:20serhiy.storchakasetmessages: + msg295685
2017-06-11 03:12:29Mariattasetversions: - Python 3.4
nosy: + Mariatta

messages: + msg295682

stage: backport needed
2017-06-10 18:15:11giampaolo.rodolasetpull_requests: + pull_request2146
2017-06-10 18:11:44giampaolo.rodolacreate