From: Serhiy Storchaka Date: Wed, 20 May 2015 13:10:04 +0000 (+0300) Subject: Issue #24245: Eliminated senseless expect clauses that have no any effect. X-Git-Tag: v3.5.0b1~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e98209c2b446205547e2298b7e6300098cfa578e;p=thirdparty%2FPython%2Fcpython.git Issue #24245: Eliminated senseless expect clauses that have no any effect. Patch by Martin Panter. --- diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index 2bfe66aa2f49..f05b34b295d1 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -221,8 +221,6 @@ def run_setup (script_name, script_args=None, stop_after="run"): # 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 index 7123ffbdd237..5b1fcc6bc4be 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -765,8 +765,6 @@ def main(tests=None, **kwargs): except KeyboardInterrupt: interrupted = True break - except: - raise if ns.findleaks: gc.collect() if gc.garbage: @@ -823,8 +821,6 @@ def main(tests=None, **kwargs): # 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 index 17f9d1bdee3d..cad83fd5aa6a 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -20,8 +20,6 @@ def _retry_thrice(func, exc, *args, **kwargs): 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 index a04fedf655cd..e74049c8aa31 100644 --- a/Lib/tkinter/font.py +++ b/Lib/tkinter/font.py @@ -112,8 +112,6 @@ class Font: 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 index 02e8f3a00b64..529265304f28 100644 --- a/Lib/unittest/test/support.py +++ b/Lib/unittest/test/support.py @@ -25,8 +25,6 @@ class TestHashing(object): 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 @@ class TestHashing(object): 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))