[Python-checkins] cpython: Issue #24245: Eliminated senseless expect clauses that have no any effect.

serhiy.storchaka python-checkins at python.org
Wed May 20 15:15:49 CEST 2015


https://hg.python.org/cpython/rev/004c689d259c
changeset:   96167:004c689d259c
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed May 20 16:10:04 2015 +0300
summary:
  Issue #24245: Eliminated senseless expect clauses that have no any effect.
Patch by Martin Panter.

files:
  Lib/distutils/core.py        |  2 --
  Lib/test/regrtest.py         |  4 ----
  Lib/test/test_urllib2net.py  |  2 --
  Lib/tkinter/font.py          |  2 --
  Lib/unittest/test/support.py |  4 ----
  5 files changed, 0 insertions(+), 14 deletions(-)


diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -221,8 +221,6 @@
         # Hmm, should we do something if exiting with a non-zero code
         # (ie. error)?
         pass
-    except:
-        raise
 
     if _setup_distribution is None:
         raise RuntimeError(("'distutils.core.setup()' was never called -- "
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -765,8 +765,6 @@
                 except KeyboardInterrupt:
                     interrupted = True
                     break
-                except:
-                    raise
             if ns.findleaks:
                 gc.collect()
                 if gc.garbage:
@@ -823,8 +821,6 @@
                 # print a newline separate from the ^C
                 print()
                 break
-            except:
-                raise
 
     if ns.single:
         if next_single_test:
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -20,8 +20,6 @@
         except exc as e:
             last_exc = e
             continue
-        except:
-            raise
     raise last_exc
 
 def _wrap_with_retry_thrice(func, exc):
diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py
--- a/Lib/tkinter/font.py
+++ b/Lib/tkinter/font.py
@@ -112,8 +112,6 @@
         try:
             if self.delete_font:
                 self._call("font", "delete", self.name)
-        except (KeyboardInterrupt, SystemExit):
-            raise
         except Exception:
             pass
 
diff --git a/Lib/unittest/test/support.py b/Lib/unittest/test/support.py
--- a/Lib/unittest/test/support.py
+++ b/Lib/unittest/test/support.py
@@ -25,8 +25,6 @@
             try:
                 if not hash(obj_1) == hash(obj_2):
                     self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
-            except KeyboardInterrupt:
-                raise
             except Exception as e:
                 self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))
 
@@ -35,8 +33,6 @@
                 if hash(obj_1) == hash(obj_2):
                     self.fail("%s and %s hash equal, but shouldn't" %
                               (obj_1, obj_2))
-            except KeyboardInterrupt:
-                raise
             except Exception as e:
                 self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e))
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list