Terry J. Reedy added the comment:

A couple of years ago, when I pushed 'except: pass', I was told in post-review 
that grandfathered bad code is no excuse for more bad code and that I should be 
explicit, including if I actually meant "except BaseException:", which in this 
case I did.  No other developer said otherwise.  I took the above to be the 
general consensus. I agree with it, one reason being that bare excepts are 
speed bumps when reading someone else's code.

Victor> generic change "except: pass" to "except Exception: pass"
This is not correct without case-by-case examination.

#16261 had 2 patches.  The patch for doc examples changed 3 'except:'s to 
'except Exception:'  I believe these are correct, or correct enough.  They all 
need to *not* catch KeyboardInterrupt.  The patch for lib code never changed to 
Exception, but something tighter.

The patch committed for #16261 patched 7 files (down from the original proposed 
11).  Even that took a couple of years to get a second review.  I think further 
followup patches should probably change even fewer files and be attached to 
new, narrowly focused issues.

Raymond, since you closed this once, and since no new patch has been submitted, 
I presume you do not mind if I reclose this.

----------
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
type:  -> enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21259>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to