[New-bugs-announce] [issue24245] Eliminate do-nothing exception handlers

Martin Panter report at bugs.python.org
Wed May 20 07:48:18 CEST 2015


New submission from Martin Panter:

These changes remove exception handlers that simply reraise the exception. They are not needed because either they are at the end of the exception handler list, or the exception being reraised would not be caught by any other handler (e.g. no need to reraise SystemExit if you are only interested in Exception). I think they make the code more confusing to read.

I noticed the tkinter/font.py dead code when reading the code, Victor Stinner pointed out the distutils case in Issue 21259, and I found the rest by searching for similar cases.

 Lib/distutils/core.py        |   2 --
 Lib/idlelib/idle.pyw         |  26 +++++++++++---------------
 Lib/idlelib/rpc.py           |   5 +----
 Lib/test/regrtest.py         |   4 ----
 Lib/test/test_queue.py       |  10 +++-------
 Lib/test/test_urllib2net.py  |   2 --
 Lib/tkinter/font.py          |   2 --
 Lib/unittest/test/support.py |   4 ----

----------
components: Distutils, IDLE, Library (Lib), Tests, Tkinter
files: reraise.patch
keywords: patch
messages: 243645
nosy: dstufft, eric.araujo, vadmium
priority: normal
severity: normal
stage: patch review
status: open
title: Eliminate do-nothing exception handlers
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file39437/reraise.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24245>
_______________________________________


More information about the New-bugs-announce mailing list