Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 31 Jan 2018 14:32:08 -0500
changeset 446863 2d0766c3e7c94d7af3e40b8069aa8e3d6d4071aa
parent 446862 6bd62fcb07d3f4669259153c91e716bdb9c87195
child 446864 0adf578683387f0e3669149a9a6ebfad63507847
push id132
push userfmarier@mozilla.com
push dateWed, 07 Feb 2018 00:44:43 +0000
reviewersrwood
bugs1434430
milestone60.0a1
Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood This is a new issue that gets linted with flake8 3.5.0. Basically you should never use a blank except: statement. This will catch all exceptions, including KeyboardInterrupt and SystemExit (which is likely not intended). If a catch all is needed, use `except: Exception`. If you *really* mean to also catch KeyboardInterrupt et al, use `except: BaseException`. Of course, being specific is often better than a catch all. MozReview-Commit-ID: FKx80MLO4RN
.flake8
build/appini_header.py
build/checksums.py
build/mach_bootstrap.py
build/moz.configure/toolchain.configure
build/moz.configure/windows.configure
build/upload.py
build/variables.py
config/check_macroassembler_style.py
layout/tools/reftest/remotereftest.py
layout/tools/reftest/runreftest.py
python/mach/setup.py
python/mozterm/mozterm/terminal.py
security/manager/ssl/tests/unit/pycert.py
taskcluster/taskgraph/create.py
taskcluster/taskgraph/cron/__init__.py
testing/marionette/client/marionette_driver/transport.py
testing/marionette/harness/marionette_harness/marionette_test/testcases.py
testing/marionette/harness/marionette_harness/runner/base.py
testing/mochitest/rungeckoview.py
testing/mochitest/runrobocop.py
testing/mochitest/runtests.py
testing/mochitest/runtestsremote.py
testing/mozbase/docs/_static/structured_example.py
testing/mozbase/manifestparser/manifestparser/expression.py
testing/mozbase/manifestparser/tests/test_convert_directory.py
testing/mozbase/manifestparser/tests/test_convert_symlinks.py
testing/mozbase/mozcrash/mozcrash/mozcrash.py
testing/mozbase/mozdebug/mozdebug/mozdebug.py
testing/mozbase/mozdevice/mozdevice/adb.py
testing/mozbase/mozdevice/mozdevice/devicemanager.py
testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
testing/mozbase/mozdevice/mozdevice/droid.py
testing/mozbase/mozfile/tests/stubs.py
testing/mozbase/mozfile/tests/test_extract.py
testing/mozbase/mozfile/tests/test_move_remove.py
testing/mozbase/mozinstall/mozinstall/mozinstall.py
testing/mozbase/mozlog/mozlog/logtypes.py
testing/mozbase/mozprocess/mozprocess/processhandler.py
testing/mozbase/mozprofile/tests/test_profile_view.py
testing/mozbase/mozrunner/mozrunner/base/runner.py
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
testing/mozbase/mozrunner/mozrunner/devices/autophone.py
testing/mozbase/mozrunner/mozrunner/utils.py
testing/mozbase/mozsystemmonitor/setup.py
testing/mozbase/moztest/moztest/selftest/fixtures.py
testing/mozharness/scripts/android_emulator_unittest.py
testing/mozharness/scripts/configtest.py
testing/mozharness/scripts/desktop_unittest.py
testing/remotecppunittests.py
testing/talos/INSTALL.py
testing/talos/talos/cmanager_linux.py
testing/talos/talos/cmanager_mac.py
testing/talos/talos/cmanager_win32.py
testing/talos/talos/ffsetup.py
testing/talos/talos/mitmproxy/mitmproxy.py
testing/talos/talos/profiler/symbolicationRequest.py
testing/talos/talos/results.py
testing/talos/talos/talos_process.py
testing/talos/talos/ttest.py
testing/xpcshell/runxpcshelltests.py
toolkit/components/telemetry/parse_histograms.py
tools/lint/eslint/setup_helper.py
--- a/.flake8
+++ b/.flake8
@@ -1,6 +1,6 @@
 [flake8]
 # See http://pep8.readthedocs.io/en/latest/intro.html#configuration
-ignore = E121, E123, E126, E129, E133, E226, E241, E242, E704, W503, E402
+ignore = E121, E123, E126, E129, E133, E226, E241, E242, E704, W503, E402, E741
 max-line-length = 99
 exclude =
     testing/mochitest/pywebsocket,
--- a/build/appini_header.py
+++ b/build/appini_header.py
@@ -11,22 +11,22 @@ import sys
 
 def main(output, file):
     config = ConfigParser.RawConfigParser()
     config.read(file)
     flags = set()
     try:
         if config.getint('XRE', 'EnableProfileMigrator') == 1:
             flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR')
-    except:
+    except Exception:
         pass
     try:
         if config.getint('Crash Reporter', 'Enabled') == 1:
             flags.add('NS_XRE_ENABLE_CRASH_REPORTER')
-    except:
+    except Exception:
         pass
     appdata = dict(("%s:%s" % (s, o), config.get(s, o))
                    for s in config.sections() for o in config.options(s))
     appdata['flags'] = ' | '.join(flags) if flags else '0'
     appdata['App:profile'] = ('"%s"' % appdata['App:profile']
                               if 'App:profile' in appdata else 'NULL')
     expected = ('App:vendor', 'App:name', 'App:remotingname', 'App:version', 'App:buildid',
                 'App:id', 'Gecko:minversion', 'Gecko:maxversion')
--- a/build/checksums.py
+++ b/build/checksums.py
@@ -5,17 +5,17 @@
 
 from __future__ import with_statement
 
 from optparse import OptionParser
 import logging
 import os
 try:
     import hashlib
-except:
+except ImportError:
     hashlib = None
 
 
 def digest_file(filename, digest, chunk_size=1024):
     '''Produce a checksum for the file specified by 'filename'.  'filename'
     is a string path to a file that is opened and read in this function.  The
     checksum algorithm is specified by 'digest' and is a valid OpenSSL
     algorithm.  If the digest used is not valid or Python's hashlib doesn't
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -121,17 +121,17 @@ def search_path(mozilla_dir, packages_tx
     with open(os.path.join(mozilla_dir, packages_txt)) as f:
         packages = [line.rstrip().split(':') for line in f]
 
     def handle_package(package):
         if package[0] == 'optional':
             try:
                 for path in handle_package(package[1:]):
                     yield path
-            except:
+            except Exception:
                 pass
 
         if package[0] == 'packages.txt':
             assert len(package) == 2
             for p in search_path(mozilla_dir, package[1]):
                 yield os.path.join(mozilla_dir, p)
 
         if package[0].endswith('.pth'):
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -427,17 +427,17 @@ def get_compiler_info(compiler, language
         if line.startswith(b'%'):
             k, _, v = line.partition(' ')
             k = k.lstrip('%')
             data[k] = v.replace(' ', '').lstrip('"').rstrip('"')
             log.debug('%s = %s', k, data[k])
 
     try:
         type = CompilerType(data['COMPILER'])
-    except:
+    except Exception:
         raise FatalCheckError(
             'Unknown compiler or compiler not supported.')
 
     cplusplus = int(data.get('cplusplus', '0L').rstrip('L'))
     stdc_version = int(data.get('STDC_VERSION', '0L').rstrip('L'))
 
     version = data.get('VERSION')
     if version and type in ('msvc', 'clang-cl'):
--- a/build/moz.configure/windows.configure
+++ b/build/moz.configure/windows.configure
@@ -115,17 +115,17 @@ def valid_windows_sdk_dir(compiler, wind
             result = try_preprocess(compiler.wrapper + [compiler.compiler] +
                                     compiler.flags +
                                     ['-I', um_dir, '-I', shared_dir], 'C',
                                     check)
             if result:
                 maxver = result.splitlines()[-1]
                 try:
                     maxver = int(maxver, 0)
-                except:
+                except Exception:
                     pass
                 else:
                     sdks[d] = maxver, sdk
                     continue
         if d == windows_sdk_dir_env:
             raise FatalCheckError(
                 'Error while checking the version of the SDK in '
                 'WINDOWSSDKDIR (%s). Please verify it contains a valid and '
--- a/build/upload.py
+++ b/build/upload.py
@@ -161,17 +161,17 @@ def GetFileHashAndSize(filename):
     try:
         # open in binary mode to make sure we get consistent results
         # across all platforms
         with open(filename, "rb") as f:
             shaObj = hashlib.sha512(f.read())
             sha512Hash = shaObj.hexdigest()
 
         size = os.path.getsize(filename)
-    except:
+    except Exception:
         raise Exception("Unable to get filesize/hash from file: %s" % filename)
 
     return (sha512Hash, size)
 
 
 def GetMarProperties(filename):
     if not os.path.exists(filename):
         return {}
--- a/build/variables.py
+++ b/build/variables.py
@@ -21,17 +21,17 @@ def buildid_header(output):
         buildid = datetime.now().strftime('%Y%m%d%H%M%S')
     output.write("#define MOZ_BUILDID %s\n" % buildid)
 
 
 def get_program_output(*command):
     try:
         with open(os.devnull) as stderr:
             return subprocess.check_output(command, stderr=stderr)
-    except:
+    except Exception:
         return ''
 
 
 def get_hg_info(workdir):
     repo = get_program_output('hg', '-R', workdir, 'path', 'default')
     if repo:
         repo = repo.strip()
         if repo.startswith('ssh://'):
--- a/config/check_macroassembler_style.py
+++ b/config/check_macroassembler_style.py
@@ -136,17 +136,17 @@ def get_file_annotation(filename):
         'inline': inline,
         'arch': arch.replace('-', '_')
     }
 
 
 def get_macroassembler_definitions(filename):
     try:
         fileAnnot = get_file_annotation(filename)
-    except:
+    except Exception:
         return []
 
     style_section = False
     code_section = False
     lines = ''
     signatures = []
     with open(filename) as f:
         for line in f:
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -129,17 +129,17 @@ class ReftestServer:
         if hasattr(self, '_process'):
             try:
                 with closing(urllib2.urlopen(self.shutdownURL)) as c:
                     c.read()
 
                 rtncode = self._process.poll()
                 if (rtncode is None):
                     self._process.terminate()
-            except:
+            except Exception:
                 self.automation.log.info("Failed to shutdown server at %s" %
                                          self.shutdownURL)
                 traceback.print_exc()
                 self._process.kill()
 
 
 class RemoteReftest(RefTest):
     use_marionette = False
@@ -250,17 +250,17 @@ class RemoteReftest(RefTest):
                     if proc.ppid() == 1 or not orphans:
                         self.log.info("killing %s" % procd)
                         try:
                             os.kill(proc.pid, getattr(signal, "SIGKILL", signal.SIGTERM))
                         except Exception as e:
                             self.log.info("Failed to kill process %d: %s" % (proc.pid, str(e)))
                     else:
                         self.log.info("NOT killing %s (not an orphan?)" % procd)
-            except:
+            except Exception:
                 # may not be able to access process info for all processes
                 continue
 
     def createReftestProfile(self, options, manifest, startAfter=None):
         profile = RefTest.createReftestProfile(self,
                                                options,
                                                manifest,
                                                server=options.remoteWebServer,
@@ -362,17 +362,17 @@ class RemoteReftest(RefTest):
         self._devicemanager.removeDir(self.remoteProfile)
         self._devicemanager.removeDir(self.remoteCache)
         self._devicemanager.removeDir(self.remoteTestRoot)
         RefTest.cleanup(self, profileDir)
         if (self.pidFile != ""):
             try:
                 os.remove(self.pidFile)
                 os.remove(self.pidFile + ".xpcshell.pid")
-            except:
+            except Exception:
                 print ("Warning: cleaning up pidfile '%s' was unsuccessful "
                        "from the test harness" % self.pidFile)
 
 
 def run_test_harness(parser, options):
     dm_args = {
         'deviceRoot': options.remoteTestRoot,
         'host': options.deviceIP,
@@ -448,17 +448,17 @@ def run_test_harness(parser, options):
 # "/reftests/layout/reftests/reftest-sanity/reftest.list"
     retVal = 0
     try:
         dm.recordLogcat()
         if options.verify:
             retVal = reftest.verifyTests(options.tests, options)
         else:
             retVal = reftest.runTests(options.tests, options)
-    except:
+    except Exception:
         print "Automation Error: Exception caught while running tests"
         traceback.print_exc()
         retVal = 1
 
     reftest.stopWebServer(options)
 
     if options.printDeviceInfo:
         reftest.printDeviceInfo(printLogcat=True)
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -560,17 +560,17 @@ class RefTest(object):
                               "--total-chunks=%d" % jobsWithoutFocus,
                               "--this-chunk=%d" % chunkNumber,
                               "--marionette=%s:%d" % (host, port)]
             port += 1
 
         for jobArgs in perProcessArgs:
             try:
                 jobArgs.remove("--run-tests-in-parallel")
-            except:
+            except Exception:
                 pass
             jobArgs[0:0] = [sys.executable, "-u"]
 
         threads = [ReftestThread(args) for args in perProcessArgs[1:]]
         for t in threads:
             t.start()
 
         while True:
--- a/python/mach/setup.py
+++ b/python/mach/setup.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 try:
     from setuptools import setup
-except:
+except ImportError:
     from distutils.core import setup
 
 
 VERSION = '0.6'
 
 README = open('README.rst').read()
 
 setup(
--- a/python/mozterm/mozterm/terminal.py
+++ b/python/mozterm/mozterm/terminal.py
@@ -13,17 +13,17 @@ class NullTerminal(object):
     number_of_colors = 0
     width = 0
     height = 0
 
     def __init__(self, stream=None, **kwargs):
         self.stream = stream or sys.__stdout__
         try:
             self.is_a_tty = os.isatty(self.stream.fileno())
-        except:
+        except Exception:
             self.is_a_tty = False
 
     class NullCallableString(unicode):
         """A dummy callable Unicode stolen from blessings"""
         def __new__(cls):
             new = unicode.__new__(cls, '')
             return new
 
--- a/security/manager/ssl/tests/unit/pycert.py
+++ b/security/manager/ssl/tests/unit/pycert.py
@@ -632,17 +632,17 @@ class Certificate(object):
         sequence = univ.Sequence()
         for feature in featureList:
             featureValue = 0
             try:
                 featureValue = int(feature)
             except ValueError:
                 try:
                     featureValue = namedFeatures[feature]
-                except:
+                except Exception:
                     raise UnknownTLSFeature(feature)
             sequence.setComponentByPosition(len(sequence),
                                             univ.Integer(featureValue))
         self.addExtension(univ.ObjectIdentifier('1.3.6.1.5.5.7.1.24'), sequence,
                           critical)
 
     def addEmbeddedSCTListData(self):
         (scts, critical) = self.savedEmbeddedSCTListData
--- a/taskcluster/taskgraph/create.py
+++ b/taskcluster/taskgraph/create.py
@@ -136,11 +136,11 @@ def create_task(session, task_id, label,
         return
 
     logger.debug("Creating task with taskId {} for {}".format(task_id, label))
     res = session.put('http://taskcluster/queue/v1/task/{}'.format(task_id),
                       data=json.dumps(task_def))
     if res.status_code != 200:
         try:
             logger.error(res.json()['message'])
-        except:
+        except Exception:
             logger.error(res.text)
         res.raise_for_status()
--- a/taskcluster/taskgraph/cron/__init__.py
+++ b/taskcluster/taskgraph/cron/__init__.py
@@ -101,17 +101,17 @@ def calculate_time(options):
             time = datetime.datetime.utcnow()
     else:
         # fetch this task from the queue
         res = get_session().get(
             'http://taskcluster/queue/v1/task/' + os.environ['TASK_ID'])
         if res.status_code != 200:
             try:
                 logger.error(res.json()['message'])
-            except:
+            except Exception:
                 logger.error(res.text)
             res.raise_for_status()
         # the task's `created` time is close to when the hook ran, although that
         # may be some time ago if task execution was delayed
         created = res.json()['created']
         time = datetime.datetime.strptime(created, '%Y-%m-%dT%H:%M:%S.%fZ')
 
     # round down to the nearest 15m
--- a/testing/marionette/client/marionette_driver/transport.py
+++ b/testing/marionette/client/marionette_driver/transport.py
@@ -188,17 +188,17 @@ class TcpTransport(object):
 
         Returns a tuple of the protocol level and the application type.
         """
         try:
             self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
             self._sock.settimeout(self.socket_timeout)
 
             self._sock.connect((self.host, self.port))
-        except:
+        except Exception:
             # Unset so that the next attempt to send will cause
             # another connection attempt.
             self._sock = None
             raise
 
         try:
             with SocketTimeout(self._sock, 60.0):
                 # first packet is always a JSON Object
--- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py
@@ -139,25 +139,25 @@ class CommonTestCase(unittest.TestCase):
                 else:
                     self.setUp()
             except SkipTest as e:
                 self._addSkip(result, str(e))
             except (KeyboardInterrupt, UnresponsiveInstanceException) as e:
                 raise
             except _ExpectedFailure as e:
                 expected_failure(result, e.exc_info)
-            except:
+            except Exception:
                 self._enter_pm()
                 result.addError(self, sys.exc_info())
             else:
                 try:
                     if self.expected == 'fail':
                         try:
                             testMethod()
-                        except:
+                        except Exception:
                             raise _ExpectedFailure(sys.exc_info())
                         raise _UnexpectedSuccess
                     else:
                         testMethod()
                 except self.failureException:
                     self._enter_pm()
                     result.addFailure(self, sys.exc_info())
                 except (KeyboardInterrupt, UnresponsiveInstanceException) as e:
@@ -170,34 +170,34 @@ class CommonTestCase(unittest.TestCase):
                         addUnexpectedSuccess(self)
                     else:
                         warnings.warn("TestResult has no addUnexpectedSuccess method, "
                                       "reporting as failures",
                                       RuntimeWarning)
                         result.addFailure(self, sys.exc_info())
                 except SkipTest as e:
                     self._addSkip(result, str(e))
-                except:
+                except Exception:
                     self._enter_pm()
                     result.addError(self, sys.exc_info())
                 else:
                     success = True
                 try:
                     if self.expected == "fail":
                         try:
                             self.tearDown()
-                        except:
+                        except Exception:
                             raise _ExpectedFailure(sys.exc_info())
                     else:
                         self.tearDown()
                 except (KeyboardInterrupt, UnresponsiveInstanceException) as e:
                     raise
                 except _ExpectedFailure as e:
                     expected_failure(result, e.exc_info)
-                except:
+                except Exception:
                     self._enter_pm()
                     result.addError(self, sys.exc_info())
                     success = False
             # Here we could handle doCleanups() instead of calling cleanTest directly
             self.cleanTest()
 
             if success:
                 result.addSuccess(self)
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -907,34 +907,34 @@ class BaseMarionetteTestRunner(object):
 
                 repeat_index += 1
 
         except KeyboardInterrupt:
             # in case of KeyboardInterrupt during the test execution
             # we want to display current test results.
             # so we keep the exception to raise it later.
             interrupted = sys.exc_info()
-        except:
+        except Exception:
             # For any other exception we return immediately and have to
             # cleanup running processes
             self.cleanup()
             raise
 
         try:
             self._print_summary(tests)
             self.record_crash()
             self.elapsedtime = time.time() - start_time
 
             for run_tests in self.mixin_run_tests:
                 run_tests(tests)
             if self.shuffle:
                 self.logger.info("Using shuffle seed: %d" % self.shuffle_seed)
 
             self.logger.suite_end()
-        except:
+        except Exception:
             # raise only the exception if we were not interrupted
             if not interrupted:
                 raise
         finally:
             self.cleanup()
 
             # reraise previous interruption now
             if interrupted:
--- a/testing/mochitest/rungeckoview.py
+++ b/testing/mochitest/rungeckoview.py
@@ -196,17 +196,17 @@ class GeckoviewTestRunner:
                     remote_dir
                 # Whilst no crash was found, the run should still display as a failure
                 return True
             self.dm.getDirectory(remote_dir, dump_dir)
             crashed = mozcrash.log_crashes(self.log, dump_dir, symbols_path, test=self.test_name)
         finally:
             try:
                 shutil.rmtree(dump_dir)
-            except:
+            except Exception:
                 self.log.warn("unable to remove directory: %s" % dump_dir)
         return crashed
 
     def cleanup(self):
         """
            Cleanup at end of job run.
         """
         self.log.debug("Cleaning up...")
@@ -228,17 +228,17 @@ def run_test_harness(log, parser, option
 
     runner = GeckoviewTestRunner(log, dm, options)
     result = -1
     try:
         result = runner.run_tests()
     except KeyboardInterrupt:
         log.info("rungeckoview.py | Received keyboard interrupt")
         result = -1
-    except:
+    except Exception:
         traceback.print_exc()
         log.error(
             "rungeckoview.py | Received unexpected exception while running tests")
         result = 1
     finally:
         try:
             runner.cleanup()
         except mozdevice.DMError:
--- a/testing/mochitest/runrobocop.py
+++ b/testing/mochitest/runrobocop.py
@@ -474,17 +474,17 @@ class RobocopTestRunner(MochitestDesktop
                     "Unable to retrieve log file (%s) from remote device" %
                     self.remoteLog)
             log_result = self.parseLocalLog()
             if result != 0 or log_result != 0:
                 # Display remote diagnostics; if running in mach, keep output
                 # terse.
                 if self.options.log_mach is None:
                     self.printDeviceInfo(printLogcat=True)
-        except:
+        except Exception:
             self.log.error(
                 "Automation Error: Exception caught while running tests")
             traceback.print_exc()
             result = 1
         self.log.debug("Test %s completes with status %d (log status %d)" %
                        (test['name'], int(result), int(log_result)))
         return result
 
@@ -562,17 +562,17 @@ def run_test_harness(parser, options):
         message_logger.logger = robocop.log
         message_logger.buffering = False
         robocop.message_logger = message_logger
         robocop.log.debug("options=%s" % vars(options))
         runResult = robocop.runTests()
     except KeyboardInterrupt:
         robocop.log.info("runrobocop.py | Received keyboard interrupt")
         runResult = -1
-    except:
+    except Exception:
         traceback.print_exc()
         robocop.log.error(
             "runrobocop.py | Received unexpected exception while running tests")
         runResult = 1
     finally:
         try:
             robocop.cleanup()
         except mozdevice.DMError:
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -514,17 +514,17 @@ class MochitestServer(object):
             # https://bugzilla.mozilla.org/show_bug.cgi?id=912285
             #      rtncode = self._process.poll()
             rtncode = self._process.proc.poll()
             if rtncode is None:
                 # TODO: need ProcessHandler.terminate() and/or .send_signal()
                 # https://bugzilla.mozilla.org/show_bug.cgi?id=912285
                 # self._process.terminate()
                 self._process.proc.terminate()
-        except:
+        except Exception:
             self._log.info("Failed to stop web server on %s" % self.shutdownURL)
             traceback.print_exc()
             self._process.kill()
 
 
 class WebSocketServer(object):
 
     "Class which encapsulates the mod_pywebsocket server"
@@ -1168,17 +1168,17 @@ class MochitestDesktop(object):
                 self.log.error("runtests.py | websocket/process bridge failed "
                                "to launch. Are all the dependencies installed?")
                 return
 
             try:
                 sock = socket.create_connection(("127.0.0.1", 8191))
                 sock.close()
                 break
-            except:
+            except Exception:
                 time.sleep(0.1)
         else:
             self.log.error("runtests.py | Timed out while waiting for "
                            "websocket/process bridge startup.")
 
     def startServers(self, options, debuggerInfo, ignoreSSLTunnelExts=False):
         # start servers and set ports
         # TODO: pass these values, don't set on `self`
@@ -1959,17 +1959,17 @@ toolbar#nav-bar {
             os.remove(self.manifest)
         if hasattr(self, 'profile'):
             del self.profile
         if options.pidFile != "":
             try:
                 os.remove(options.pidFile)
                 if os.path.exists(options.pidFile + ".xpcshell.pid"):
                     os.remove(options.pidFile + ".xpcshell.pid")
-            except:
+            except Exception:
                 self.log.warning(
                     "cleaning up pidfile '%s' was unsuccessful from the test harness" %
                     options.pidFile)
         options.manifestFile = None
 
     def dumpScreen(self, utilityPath):
         if self.haveDumpedScreen:
             self.log.info(
@@ -2067,17 +2067,17 @@ toolbar#nav-bar {
     def checkForRunningBrowsers(self):
         firefoxes = ""
         if HAVE_PSUTIL:
             attrs = ['pid', 'ppid', 'name', 'cmdline', 'username']
             for proc in psutil.process_iter():
                 try:
                     if 'firefox' in proc.name():
                         firefoxes = "%s%s\n" % (firefoxes, proc.as_dict(attrs=attrs))
-                except:
+                except Exception:
                     # may not be able to access process info for all processes
                     continue
         if len(firefoxes) > 0:
             # In automation, this warning is unexpected and should be investigated.
             # In local testing, this is probably okay, as long as the browser is not
             # running a marionette server.
             self.log.warning("Found 'firefox' running before starting test browser!")
             self.log.warning(firefoxes)
@@ -2779,17 +2779,17 @@ toolbar#nav-bar {
                     screenshotOnFail=options.screenshotOnFail,
                     bisectChunk=options.bisectChunk,
                     marionette_args=marionette_args,
                 )
                 status = ret or status
         except KeyboardInterrupt:
             self.log.info("runtests.py | Received keyboard interrupt.\n")
             status = -1
-        except:
+        except Exception:
             traceback.print_exc()
             self.log.error(
                 "Automation Error: Received unexpected exception while running application\n")
             status = 1
         finally:
             self.stopServers()
 
         ignoreMissingLeaks = options.ignoreMissingLeaks
@@ -2832,22 +2832,22 @@ toolbar#nav-bar {
 
         browser_pid = browser_pid or proc.pid
         child_pids = self.extract_child_pids(processLog, browser_pid)
         self.log.info('Found child pids: %s' % child_pids)
 
         if HAVE_PSUTIL:
             try:
                 browser_proc = [psutil.Process(browser_pid)]
-            except:
+            except Exception:
                 self.log.info('Failed to get proc for pid %d' % browser_pid)
                 browser_proc = []
             try:
                 child_procs = [psutil.Process(pid) for pid in child_pids]
-            except:
+            except Exception:
                 self.log.info('Failed to get child procs')
                 child_procs = []
             for pid in child_pids:
                 self.killAndGetStack(pid, utilityPath, debuggerInfo,
                                      dump_screen=not debuggerInfo)
             gone, alive = psutil.wait_procs(child_procs, timeout=30)
             for p in gone:
                 self.log.info('psutil found pid %s dead' % p.pid)
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -365,17 +365,17 @@ def run_test_harness(parser, options):
 
     mochitest.mozLogName = "moz.log"
     try:
         dm.recordLogcat()
         if options.verify:
             retVal = mochitest.verifyTests(options)
         else:
             retVal = mochitest.runTests(options)
-    except:
+    except Exception:
         log.error("Automation Error: Exception caught while running tests")
         traceback.print_exc()
         mochitest.stopServers()
         try:
             mochitest.cleanup(options)
         except mozdevice.DMError:
             # device error cleaning up... oh well!
             pass
--- a/testing/mozbase/docs/_static/structured_example.py
+++ b/testing/mozbase/docs/_static/structured_example.py
@@ -68,17 +68,17 @@ class TestRunner(object):
         status = None
         message = None
         expected = func._expected if hasattr(func, "_expected") else "PASS"
         try:
             func()
         except TestAssertion as e:
             status = "FAIL"
             message = e.message
-        except:
+        except Exception:
             status = "ERROR"
             message = traceback.format_exc()
         else:
             status = "PASS"
         self.logger.test_end(name, status=status, expected=expected, message=message)
 
 
 def get_parser():
@@ -92,14 +92,14 @@ def main():
 
     args = parser.parse_args()
 
     logger = commandline.setup_logging("structured-example", args, {"raw": sys.stdout})
 
     runner = TestRunner()
     try:
         runner.run()
-    except:
+    except Exception:
         logger.critical("Error during test run:\n%s" % traceback.format_exc())
 
 
 if __name__ == "__main__":
     main()
--- a/testing/mozbase/manifestparser/manifestparser/expression.py
+++ b/testing/mozbase/manifestparser/manifestparser/expression.py
@@ -301,17 +301,17 @@ class ExpressionParser(object):
         Parse and return the value of the expression in the text
         passed to the constructor. Raises a ParseError if the expression
         could not be parsed.
         """
         try:
             self.iter = self._tokenize()
             self.token = self.iter.next()
             return self.expression()
-        except:
+        except Exception:
             extype, ex, tb = sys.exc_info()
             formatted = ''.join(traceback.format_exception_only(extype, ex))
             reraise(ParseError("could not parse: %s\nexception: %svariables: %s" %
                     (self.text, formatted, self.valuemapping)), None, tb)
 
     __call__ = parse
 
 
--- a/testing/mozbase/manifestparser/tests/test_convert_directory.py
+++ b/testing/mozbase/manifestparser/tests/test_convert_directory.py
@@ -68,17 +68,17 @@ class TestDirectoryConversion(unittest.T
 [%(stub)s/fleem]
 
 [%(stub)s/foo]
 
 [%(stub)s/subdir/subfile]
 
 """  # noqa
             self.assertEqual(str(manifest), out_tmpl % dict(stub=stub))
-        except:
+        except BaseException:
             raise
         finally:
             shutil.rmtree(stub)  # cleanup
 
     def test_convert_directory_manifests_in_place(self):
         """
         keep the manifests in place
         """
@@ -91,34 +91,34 @@ class TestDirectoryConversion(unittest.T
             parser = ManifestParser()
             parser.read(os.path.join(stub, 'manifest.ini'))
             self.assertEqual([i['name'] for i in parser.tests],
                              ['subfile', 'bar', 'fleem', 'foo'])
             parser = ManifestParser()
             parser.read(os.path.join(stub, 'subdir', 'manifest.ini'))
             self.assertEqual(len(parser.tests), 1)
             self.assertEqual(parser.tests[0]['name'], 'subfile')
-        except:
+        except BaseException:
             raise
         finally:
             shutil.rmtree(stub)
 
     def test_manifest_ignore(self):
         """test manifest `ignore` parameter for ignoring directories"""
 
         stub = self.create_stub()
         try:
             ManifestParser.populate_directory_manifests(
                 [stub], filename='manifest.ini', ignore=('subdir',))
             parser = ManifestParser()
             parser.read(os.path.join(stub, 'manifest.ini'))
             self.assertEqual([i['name'] for i in parser.tests],
                              ['bar', 'fleem', 'foo'])
             self.assertFalse(os.path.exists(os.path.join(stub, 'subdir', 'manifest.ini')))
-        except:
+        except BaseException:
             raise
         finally:
             shutil.rmtree(stub)
 
     def test_pattern(self):
         """test directory -> manifest with a file pattern"""
 
         stub = self.create_stub()
@@ -126,17 +126,17 @@ class TestDirectoryConversion(unittest.T
             parser = convert([stub], pattern='f*', relative_to=stub)
             self.assertEqual([i['name'] for i in parser.tests],
                              ['fleem', 'foo'])
 
             # test multiple patterns
             parser = convert([stub], pattern=('f*', 's*'), relative_to=stub)
             self.assertEqual([i['name'] for i in parser.tests],
                              ['fleem', 'foo', 'subdir/subfile'])
-        except:
+        except BaseException:
             raise
         finally:
             shutil.rmtree(stub)
 
     def test_update(self):
         """
         Test our ability to update tests from a manifest and a directory of
         files
--- a/testing/mozbase/manifestparser/tests/test_convert_symlinks.py
+++ b/testing/mozbase/manifestparser/tests/test_convert_symlinks.py
@@ -42,17 +42,17 @@ class TestSymlinkConversion(unittest.Tes
         try:
             # subdir with in-memory manifest
             files = ['../bar', '../fleem', '../foo', 'subfile']
             subdir = os.path.join(stub, 'subdir')
             os.chdir(subdir)
             parser = convert([stub], relative_to='.')
             self.assertEqual([i['name'] for i in parser.tests],
                              files)
-        except:
+        except BaseException:
             raise
         finally:
             shutil.rmtree(stub)
             os.chdir(oldcwd)
 
     @unittest.skipIf(not hasattr(os, 'symlink'),
                      "symlinks unavailable on this platform")
     def test_relpath_symlink(self):
--- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py
+++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py
@@ -79,17 +79,17 @@ def check_for_crashes(dump_directory,
 
     Returns number of minidump files found.
     """
 
     # try to get the caller's filename if no test name is given
     if test_name is None:
         try:
             test_name = os.path.basename(sys._getframe(1).f_code.co_filename)
-        except:
+        except Exception:
             test_name = "unknown"
 
     crash_info = CrashInfo(dump_directory, symbols_path, dump_save_path=dump_save_path,
                            stackwalk_binary=stackwalk_binary)
 
     if not crash_info.has_dumps:
         return False
 
@@ -343,17 +343,17 @@ def check_for_java_exception(logcat, tes
 
     Returns True if a fatal Java exception was found, False otherwise.
     """
 
     # try to get the caller's filename if no test name is given
     if test_name is None:
         try:
             test_name = os.path.basename(sys._getframe(1).f_code.co_filename)
-        except:
+        except Exception:
             test_name = "unknown"
 
     found_exception = False
 
     for i, line in enumerate(logcat):
         # Logs will be of form:
         #
         # 01-30 20:15:41.937 E/GeckoAppShell( 1703): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 9 ("GeckoBackgroundThread") # noqa
@@ -557,17 +557,17 @@ def cleanup_pending_crash_reports():
         location = os.path.expanduser("~/Library/Application Support/firefox/Crash Reports")
     else:
         location = os.path.expanduser("~/.mozilla/firefox/Crash Reports")
     logger = get_logger()
     if os.path.exists(location):
         try:
             mozfile.remove(location)
             logger.info("Removed pending crash reports at '%s'" % location)
-        except:
+        except Exception:
             pass
 
 
 if __name__ == '__main__':
     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument('--stackwalk-binary', '-b')
     parser.add_argument('--dump-save-path', '-o')
--- a/testing/mozbase/mozdebug/mozdebug/mozdebug.py
+++ b/testing/mozbase/mozdebug/mozdebug/mozdebug.py
@@ -98,17 +98,17 @@ def get_debugger_path(debugger):
         # it's in a protected directory such as /usr/bin. This is the case for
         # lldb, so we try to find an instance under the Xcode install instead.
 
         # Attempt to use the xcrun util to find the path.
         try:
             path = check_output(['xcrun', '--find', 'lldb']).strip()
             if path:
                 return path
-        except:
+        except Exception:
             # Just default to find_executable instead.
             pass
 
     return find_executable(debugger)
 
 
 def get_debugger_info(debugger, debuggerArgs=None, debuggerInteractive=False):
     '''
--- a/testing/mozbase/mozdevice/mozdevice/adb.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb.py
@@ -1743,17 +1743,17 @@ class ADBDevice(ADBCommand):
             # the remote destination directory exists, adb push will
             # copy the source directory *into* the destination
             # directory otherwise it will copy the source directory
             # *onto* the destination directory.
             if self._adb_version >= '1.0.36':
                 remote = '/'.join(remote.rstrip('/').split('/')[:-1])
         try:
             self.command_output(["push", local, remote], timeout=timeout)
-        except:
+        except BaseException:
             raise
         finally:
             if copy_required:
                 shutil.rmtree(temp_parent)
 
     def pull(self, remote, local, timeout=None):
         """Pulls a file or directory from the device.
 
@@ -1796,17 +1796,17 @@ class ADBDevice(ADBCommand):
             if local_name != remote_name:
                 copy_required = True
                 temp_parent = tempfile.mkdtemp()
                 local = os.path.join(temp_parent, remote_name)
             else:
                 local = '/'.join(local.rstrip('/').split('/')[:-1])
         try:
             self.command_output(["pull", remote, local], timeout=timeout)
-        except:
+        except BaseException:
             raise
         finally:
             if copy_required:
                 dir_util.copy_tree(local, original_local)
                 shutil.rmtree(temp_parent)
 
     def rm(self, path, recursive=False, force=False, timeout=None, root=False):
         """Delete files or directories on the device.
--- a/testing/mozbase/mozdevice/mozdevice/devicemanager.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanager.py
@@ -565,17 +565,17 @@ class DeviceManager(object):
         Return the MD5 sum of a file on the host.
         """
         f = open(filename, 'rb')
         if f is None:
             return None
 
         try:
             mdsum = hashlib.md5()
-        except:
+        except Exception:
             return None
 
         while 1:
             data = f.read(1024)
             if not data:
                 break
             mdsum.update(data)
 
--- a/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
@@ -274,17 +274,17 @@ class DeviceManagerADB(DeviceManager):
                 self.pushFile(localZip, remoteZip, retryLimit=retryLimit, createDir=False)
                 mozfile.remove(localZip)
                 data = self._runCmd(["shell", "unzip", "-o", remoteZip,
                                      "-d", remoteDir]).output[0]
                 self._checkCmd(["shell", "rm", remoteZip],
                                retryLimit=retryLimit, timeout=self.short_timeout)
                 if re.search("unzip: exiting", data) or re.search("Operation not permitted", data):
                     raise Exception("unzip failed, or permissions error")
-            except:
+            except Exception:
                 self._logger.warning(traceback.format_exc())
                 self._logger.warning("zip/unzip failure: falling back to normal push")
                 self._useZip = False
                 self.pushDir(localDir, remoteDir, retryLimit=retryLimit, timeout=timeout)
         else:
             localDir = os.path.normpath(localDir)
             remoteDir = os.path.normpath(remoteDir)
             tempParent = tempfile.mkdtemp()
@@ -300,17 +300,17 @@ class DeviceManagerADB(DeviceManager):
             # *onto* the destination directory.
             if self._adb_version >= '1.0.36':
                 remoteDir = '/'.join(remoteDir.rstrip('/').split('/')[:-1])
             try:
                 if self._checkCmd(["push", newLocal, remoteDir],
                                   retryLimit=retryLimit, timeout=timeout):
                     raise DMError("failed to push %s (copy of %s) to %s" %
                                   (newLocal, localDir, remoteDir))
-            except:
+            except BaseException:
                 raise
             finally:
                 mozfile.remove(tempParent)
 
     def dirExists(self, remotePath):
         self._detectLsModifier()
         data = self._runCmd(["shell", "ls", self._lsModifier, remotePath + '/'],
                             timeout=self.short_timeout).output
@@ -445,17 +445,17 @@ class DeviceManagerADB(DeviceManager):
         self._logger.info(acmd)
         self._checkCmd(acmd)
         return outputFile
 
     def killProcess(self, appname, sig=None, native=False):
         if not native and not sig:
             try:
                 self.shellCheckOutput(["am", "force-stop", appname], timeout=self.short_timeout)
-            except:
+            except Exception:
                 # no problem - will kill it instead
                 self._logger.info("killProcess failed force-stop of %s" % appname)
 
         shell_args = ["shell"]
         if self._sdk_version >= version_codes.N:
             # Bug 1334613 - force use of root
             if self._haveRootShell is None and self._haveSu is None:
                 self._checkForRoot()
@@ -584,17 +584,17 @@ class DeviceManagerADB(DeviceManager):
                  ('/sdcard', 'tests'),
                  ('/data/local', 'tests')]
         for (basePath, subPath) in paths:
             if self.dirExists(basePath):
                 root = os.path.join(basePath, subPath)
                 try:
                     self.mkDir(root)
                     return root
-                except:
+                except Exception:
                     pass
 
         raise DMError("Unable to set up device root using paths: [%s]"
                       % ", ".join(["'%s'" % os.path.join(b, s) for b, s in paths]))
 
     def getTempDir(self):
         # Cache result to speed up operations depending
         # on the temporary directory.
@@ -864,17 +864,17 @@ class DeviceManagerADB(DeviceManager):
     def _isLocalZipAvailable(self):
         def _noOutput(line):
             # suppress output from zip ProcessHandler
             pass
         try:
             proc = ProcessHandler(["zip", "-?"], storeOutput=False, processOutputLine=_noOutput)
             proc.run()
             proc.wait()
-        except:
+        except Exception:
             return False
         return True
 
     def _verifyZip(self):
         # If "zip" can be run locally, and "unzip" can be run remotely, then pushDir
         # can use these to push just one file per directory -- a significant
         # optimization for large directories.
         self._useZip = False
--- a/testing/mozbase/mozdevice/mozdevice/droid.py
+++ b/testing/mozbase/mozdevice/mozdevice/droid.py
@@ -158,17 +158,17 @@ class DroidADB(DeviceManagerADB, DroidMi
 
     def getTopActivity(self):
         package = None
         data = None
         try:
             # Increased timeout to 60 seconds after intermittent timeouts at 30.
             data = self.shellCheckOutput(
                 ["dumpsys", "window", "windows"], timeout=60)
-        except:
+        except Exception:
             # dumpsys seems to intermittently fail (seen on 4.3 emulator), producing
             # no output.
             return ""
         # "dumpsys window windows" produces many lines of input. The top/foreground
         # activity is indicated by something like:
         #   mFocusedApp=AppWindowToken{483e6db0 token=HistoryRecord{484dcad8 com.mozilla.something/.something}} # noqa
         # or, on other devices:
         #   FocusedApplication: name='AppWindowToken{41a65340 token=ActivityRecord{418fbd68 org.mozilla.fennec_mozdev/org.mozilla.gecko.BrowserApp}}', dispatchingTimeout=5000.000ms # noqa
--- a/testing/mozbase/mozfile/tests/stubs.py
+++ b/testing/mozbase/mozfile/tests/stubs.py
@@ -29,11 +29,11 @@ def create_stub():
             contents = path[-1]
             f = open(fullpath, 'w')
             f.write(contents)
             f.close()
         return tempdir
     except Exception:
         try:
             shutil.rmtree(tempdir)
-        except:
+        except Exception:
             pass
         raise
--- a/testing/mozbase/mozfile/tests/test_extract.py
+++ b/testing/mozbase/mozfile/tests/test_extract.py
@@ -127,34 +127,34 @@ class TestExtract(unittest.TestCase):
     def create_tarball(self):
         """create a stub tarball for testing"""
         tempdir = stubs.create_stub()
         filename = tempfile.mktemp(suffix='.tar')
         archive = tarfile.TarFile(filename, mode='w')
         try:
             for path in stubs.files:
                 archive.add(os.path.join(tempdir, *path), arcname=os.path.join(*path))
-        except:
+        except BaseException:
             os.remove(archive)
             raise
         finally:
             shutil.rmtree(tempdir)
         archive.close()
         return filename
 
     def create_zip(self):
         """create a stub zipfile for testing"""
 
         tempdir = stubs.create_stub()
         filename = tempfile.mktemp(suffix='.zip')
         archive = zipfile.ZipFile(filename, mode='w')
         try:
             for path in stubs.files:
                 archive.write(os.path.join(tempdir, *path), arcname=os.path.join(*path))
-        except:
+        except BaseException:
             os.remove(filename)
             raise
         finally:
             shutil.rmtree(tempdir)
         archive.close()
         return filename
 
 
--- a/testing/mozbase/mozfile/tests/test_move_remove.py
+++ b/testing/mozbase/mozfile/tests/test_move_remove.py
@@ -40,17 +40,17 @@ class FileOpenCloseThread(threading.Thre
 
     def run(self):
         with open(self.path):
             self.file_opened.set()
             time.sleep(self.delay)
         if self.delete:
             try:
                 os.remove(self.path)
-            except:
+            except Exception:
                 pass
 
 
 @contextmanager
 def wait_file_opened_in_thread(*args, **kwargs):
     thread = FileOpenCloseThread(*args, **kwargs)
     thread.start()
     thread.file_opened.wait()
--- a/testing/mozbase/mozinstall/mozinstall/mozinstall.py
+++ b/testing/mozbase/mozinstall/mozinstall/mozinstall.py
@@ -104,17 +104,17 @@ def install(src, dest):
                  files the folder should not exist yet)
     """
 
     if not is_installer(src):
         msg = "{} is not a valid installer file".format(src)
         if '://' in src:
             try:
                 return _install_url(src, dest)
-            except:
+            except Exception:
                 exc, val, tb = sys.exc_info()
                 msg = "{} ({})".format(msg, val)
                 reraise(InvalidSource, msg, tb)
         raise InvalidSource(msg)
 
     src = os.path.realpath(src)
     dest = os.path.realpath(dest)
 
@@ -130,28 +130,28 @@ def install(src, dest):
             install_dir = _install_dmg(src, dest)
         elif src.lower().endswith('.exe'):
             install_dir = _install_exe(src, dest)
         elif zipfile.is_zipfile(src) or tarfile.is_tarfile(src):
             install_dir = mozfile.extract(src, dest)[0]
 
         return install_dir
 
-    except:
+    except BaseException:
         cls, exc, trbk = sys.exc_info()
         if did_we_create:
             try:
                 # try to uninstall this properly
                 uninstall(dest)
-            except:
+            except Exception:
                 # uninstall may fail, let's just try to clean the folder
                 # in this case
                 try:
                     mozfile.remove(dest)
-                except:
+                except Exception:
                     pass
         if issubclass(cls, Exception):
             error = InstallError('Failed to install "%s (%s)"' % (src, str(exc)))
             reraise(InstallError, error, trbk)
         # any other kind of exception like KeyboardInterrupt is just re-raised.
         reraise(cls, exc, trbk)
 
     finally:
--- a/testing/mozbase/mozlog/mozlog/logtypes.py
+++ b/testing/mozbase/mozlog/mozlog/logtypes.py
@@ -117,17 +117,17 @@ class DataType(object):
     def __call__(self, value):
         if value == self.default:
             if self.optional:
                 return missing
             return self.default
 
         try:
             return self.convert(value)
-        except:
+        except Exception:
             raise ValueError("Failed to convert value %s of type %s for field %s to type %s" %
                              (value, type(value).__name__, self.name, self.__class__.__name__))
 
 
 class ContainerType(DataType):
     """A DataType that contains other DataTypes.
 
     ContainerTypes must specify which other DataType they will contain. ContainerTypes
--- a/testing/mozbase/mozprocess/mozprocess/processhandler.py
+++ b/testing/mozbase/mozprocess/mozprocess/processhandler.py
@@ -140,17 +140,17 @@ class ProcessHandlerMixin(object):
                 if not self._ignore_children and self._handle and self._job:
                     self.debug("calling TerminateJobObject")
                     winprocess.TerminateJobObject(self._job, winprocess.ERROR_CONTROL_C_EXIT)
                     self.returncode = winprocess.GetExitCodeProcess(self._handle)
                 elif self._handle:
                     self.debug("calling TerminateProcess")
                     try:
                         winprocess.TerminateProcess(self._handle, winprocess.ERROR_CONTROL_C_EXIT)
-                    except:
+                    except Exception:
                         traceback.print_exc()
                         raise OSError("Could not terminate process")
                     finally:
                         winprocess.GetExitCodeProcess(self._handle)
                         self._cleanup()
             else:
                 def send_sig(sig, retries=0):
                     pid = self.detached_pid or self.pid
@@ -348,17 +348,17 @@ class ProcessHandlerMixin(object):
                         winprocess.AssignProcessToJobObject(self._job, int(hp))
 
                         # It's overkill, but we use Queue to signal between threads
                         # because it handles errors more gracefully than event or condition.
                         self._process_events = Queue()
 
                         # Spin up our thread for managing the IO Completion Port
                         self._procmgrthread = threading.Thread(target=self._procmgr)
-                    except:
+                    except Exception:
                         print("""Exception trying to use job objects;
 falling back to not using job objects for managing child processes""", file=sys.stderr)
                         tb = traceback.format_exc()
                         print(tb, file=sys.stderr)
                         # Ensure no dangling handles left behind
                         self._cleanup_job_io_port()
                 else:
                     self._job = None
@@ -516,17 +516,17 @@ falling back to not using job objects fo
                         # timeout is the max amount of time the procmgr thread will wait for
                         # child processes to shutdown before killing them with extreme prejudice.
                         item = self._process_events.get(
                             timeout=self.MAX_IOCOMPLETION_PORT_NOTIFICATION_DELAY +
                             self.MAX_PROCESS_KILL_DELAY)
                         if item[self.pid] == 'FINISHED':
                             self.debug("received 'FINISHED' from _procmgrthread")
                             self._process_events.task_done()
-                    except:
+                    except Exception:
                         traceback.print_exc()
                         raise OSError("IO Completion Port failed to signal process shutdown")
                     finally:
                         if self._handle:
                             self.returncode = winprocess.GetExitCodeProcess(self._handle)
                         self._cleanup()
 
                 else:
--- a/testing/mozbase/mozprofile/tests/test_profile_view.py
+++ b/testing/mozbase/mozprofile/tests/test_profile_view.py
@@ -34,17 +34,17 @@ class TestProfilePrint(unittest.TestCase
             profile = mozprofile.FirefoxProfile(tempdir)
             parts = profile.summary(return_parts=True)
             parts = dict(parts)
 
             self.assertEqual(parts['Path'], tempdir)
             self.assertEqual(set(parts.keys()), keys)
             self.assertEqual(pref_string, parts['user.js'].strip())
 
-        except:
+        except BaseException:
             raise
         finally:
             mozfile.rmtree(tempdir)
 
     def test_strcast(self):
         """
         test casting to a string
         """
--- a/testing/mozbase/mozrunner/mozrunner/base/runner.py
+++ b/testing/mozbase/mozrunner/mozrunner/base/runner.py
@@ -233,17 +233,17 @@ class BaseRunner(object):
                     crash_count = mozcrash.check_for_crashes(
                         dump_directory,
                         self.symbols_path,
                         dump_save_path=dump_save_path,
                         test_name=test_name,
                         quiet=quiet)
 
             self.crashed += crash_count
-        except:
+        except Exception:
             traceback.print_exc()
 
         return crash_count
 
     def cleanup(self):
         """
         Cleanup all runner state
         """
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -291,17 +291,17 @@ def verify_android_device(build_obj, ins
                         # Get JimDB utilities from git repository
                         proc = ProcessHandler(['git', 'pull'], cwd=jimdb_utils_path)
                         proc.run()
                         git_pull_complete = False
                         try:
                             proc.wait()
                             if proc.proc.returncode == 0:
                                 git_pull_complete = True
-                        except:
+                        except Exception:
                             if proc.poll() is None:
                                 proc.kill(signal.SIGTERM)
                         if not git_pull_complete:
                             _log_warning("Unable to update JimDB utils from git -- "
                                          "some JimDB features may be unavailable.")
                     else:
                         _log_warning("Unable to install JimDB -- unable to fetch from tooltool.")
                 else:
@@ -581,17 +581,17 @@ class AndroidEmulator(object):
         return False
 
     def wait(self):
         """
            Wait for the emulator to close. If interrupted, close the emulator.
         """
         try:
             self.proc.wait()
-        except:
+        except Exception:
             if self.proc.poll() is None:
                 self.cleanup()
         return self.proc.poll()
 
     def cleanup(self):
         """
            Close the emulator.
         """
@@ -645,17 +645,17 @@ class AndroidEmulator(object):
                     self._telnet_cmd(tn, 'avd status')
                     self._telnet_cmd(tn, 'redir list')
                     self._telnet_cmd(tn, 'network status')
                     tn.write('quit\n')
                     tn.read_all()
                     telnet_ok = True
                 else:
                     _log_warning("Unable to connect to port 5554")
-            except:
+            except Exception:
                 _log_warning("Trying again after unexpected exception")
             finally:
                 if tn is not None:
                     tn.close()
             if not telnet_ok:
                 time.sleep(10)
                 if self.proc.proc.poll() is not None:
                     _log_warning("Emulator has already completed!")
@@ -734,17 +734,17 @@ def _find_sdk_exe(substs, exe, tools):
         else:
             _log_debug("Unable to find executable on PATH")
 
     if found:
         _log_debug("%s found at %s" % (exe, exe_path))
         try:
             creation_time = os.path.getctime(exe_path)
             _log_debug("  ...with creation time %s" % time.ctime(creation_time))
-        except:
+        except Exception:
             _log_warning("Could not get creation time for %s" % exe_path)
 
         prop_path = os.path.join(os.path.dirname(exe_path), "source.properties")
         if os.path.exists(prop_path):
             with open(prop_path, 'r') as f:
                 for line in f.readlines():
                     if line.startswith("Pkg.Revision"):
                         line = line.strip()
@@ -810,17 +810,17 @@ def _tooltool_fetch():
     command = [sys.executable, 'tooltool.py',
                'fetch', '-o', '-m', 'releng.manifest']
     proc = ProcessHandler(
         command, processOutputLine=outputHandler, storeOutput=False,
         cwd=EMULATOR_HOME_DIR)
     proc.run()
     try:
         proc.wait()
-    except:
+    except Exception:
         if proc.poll() is None:
             proc.kill(signal.SIGTERM)
 
 
 def _get_host_platform():
     plat = None
     if 'darwin' in str(sys.platform).lower():
         plat = 'macosx64'
@@ -840,17 +840,17 @@ def _get_device_platform(substs):
     dm = DeviceManagerADB(autoconnect=False, adbPath=adb_path, retryLimit=1)
     sdk_level = None
     try:
         cmd = ['getprop', 'ro.build.version.sdk']
         _log_debug(cmd)
         output = dm.shellCheckOutput(cmd, timeout=10)
         if output:
             sdk_level = int(output)
-    except:
+    except Exception:
         _log_warning("unable to determine Android sdk level")
     pie = ''
     if sdk_level and sdk_level >= 21:
         pie = '-pie'
     if substs['TARGET_CPU'].startswith('arm'):
         return 'arm%s' % pie
     return 'x86%s' % pie
 
--- a/testing/mozbase/mozrunner/mozrunner/devices/autophone.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/autophone.py
@@ -62,17 +62,17 @@ class AutophoneRunner(object):
         """
            Persist self.config to a file.
         """
         try:
             with open(self.CONFIG_FILE, 'w') as f:
                 json.dump(self.config, f)
             if self.verbose:
                 print("saved configuration: %s" % self.config)
-        except:
+        except Exception:
             self.build_obj.log(logging.ERROR, "autophone", {},
                                "unable to save 'mach autophone' "
                                "configuration to %s" % self.CONFIG_FILE)
             if self.verbose:
                 self.build_obj.log(logging.ERROR, "autophone", {},
                                    str(sys.exc_info()[0]))
 
     def load_config(self):
@@ -80,17 +80,17 @@ class AutophoneRunner(object):
            Import the configuration info saved by save_config().
         """
         if os.path.exists(self.CONFIG_FILE):
             try:
                 with open(self.CONFIG_FILE, 'r') as f:
                     self.config = json.load(f)
                 if self.verbose:
                     print("loaded configuration: %s" % self.config)
-            except:
+            except Exception:
                 self.build_obj.log(logging.ERROR, "autophone", {},
                                    "unable to load 'mach autophone' "
                                    "configuration from %s" % self.CONFIG_FILE)
                 if self.verbose:
                     self.build_obj.log(logging.ERROR, "autophone", {},
                                        str(sys.exc_info()[0]))
 
     def setup_directory(self):
@@ -176,17 +176,17 @@ class AutophoneRunner(object):
             "Configure devices now? (Y/n) ").strip()
         if response.lower().startswith('y') or response == '':
             response = raw_input(
                 "Connect your rooted Android test device(s) with usb and press Enter ")
             adb_path = 'adb'
             try:
                 if os.path.exists(self.build_obj.substs["ADB"]):
                     adb_path = self.build_obj.substs["ADB"]
-            except:
+            except Exception:
                 if self.verbose:
                     self.build_obj.log(logging.ERROR, "autophone", {},
                                        str(sys.exc_info()[0]))
                 # No build environment?
                 try:
                     adb_path = which.which('adb')
                 except which.WhichError:
                     adb_path = raw_input(
@@ -203,17 +203,17 @@ class AutophoneRunner(object):
                             f.write("[device-%d]\nserialno=%s\n" % (device_index, serial))
                             device_index += 1
                             self.build_obj.log(logging.INFO, "autophone", {},
                                                "Added '%s' to device configuration." % serial)
                             keep_going = True
                         else:
                             self.build_obj.log(logging.WARNING, "autophone", {},
                                                "Device '%s' is not rooted - skipping" % serial)
-            except:
+            except Exception:
                 self.build_obj.log(logging.ERROR, "autophone", {},
                                    "Failed to get list of connected Android devices.")
                 if self.verbose:
                     self.build_obj.log(logging.ERROR, "autophone", {},
                                        str(sys.exc_info()[0]))
                 keep_going = False
             if device_index <= 1:
                 self.build_obj.log(logging.ERROR, "autophone", {},
@@ -309,17 +309,17 @@ class AutophoneRunner(object):
 [runtests]
 xre_path = %s
 utility_path = %s
 console_level = DEBUG
 log_level = DEBUG
 time_out = 300""" % (xre_path, xre_path))
             if self.verbose:
                 print("Created %s with host utilities path %s" % (defaults_path, xre_path))
-        except:
+        except Exception:
             self.build_obj.log(logging.ERROR, "autophone", {},
                                "Unable to create %s" % defaults_path)
             if self.verbose:
                 self.build_obj.log(logging.ERROR, "autophone", {},
                                    str(sys.exc_info()[0]))
 
     def configure_unittests(self):
         """
@@ -442,17 +442,17 @@ time_out = 300""" % (xre_path, xre_path)
     def verify_device(self, adb_path, device):
         """
            Check that the specified device is available and rooted.
         """
         try:
             dm = DeviceManagerADB(adbPath=adb_path, retryLimit=1, deviceSerial=device)
             if dm._haveSu or dm._haveRootShell:
                 return True
-        except:
+        except Exception:
             self.build_obj.log(
                 logging.WARN, "autophone", {},
                 "Unable to verify root on device.")
             if self.verbose:
                 self.build_obj.log(logging.ERROR, "autophone", {},
                                    str(sys.exc_info()[0]))
         return False
 
@@ -639,15 +639,15 @@ 4. Date/date-time range\
         proc = ProcessHandler(cmd, cwd=cwd, processOutputLine=_processOutput,
                               processStderrLine=_processOutput)
         proc.run()
         proc_complete = False
         try:
             proc.wait()
             if proc.proc.returncode == 0:
                 proc_complete = True
-        except:
+        except Exception:
             if proc.poll() is None:
                 proc.kill(signal.SIGTERM)
         if not proc_complete:
             if not self.verbose:
                 print(proc.output)
         return proc_complete
--- a/testing/mozbase/mozrunner/mozrunner/utils.py
+++ b/testing/mozbase/mozrunner/mozrunner/utils.py
@@ -197,17 +197,17 @@ def test_environment(xrePath, env=None, 
                 env["LSAN_OPTIONS"] = ':'.join(lsanOptions)
 
             if len(asanOptions):
                 env['ASAN_OPTIONS'] = ':'.join(asanOptions)
 
         except OSError as err:
             log.info("Failed determine available memory, disabling ASan"
                      " low-memory configuration: %s" % err.strerror)
-        except:
+        except Exception:
             log.info("Failed determine available memory, disabling ASan"
                      " low-memory configuration")
         else:
             log.info(message)
 
     tsan = bool(mozinfo.info.get("tsan"))
     if tsan and mozinfo.isLinux:
         # Symbolizer support.
--- a/testing/mozbase/mozsystemmonitor/setup.py
+++ b/testing/mozbase/mozsystemmonitor/setup.py
@@ -8,17 +8,17 @@ import os
 
 from setuptools import setup
 
 PACKAGE_VERSION = '0.3'
 
 try:
     pwd = os.path.dirname(os.path.abspath(__file__))
     description = open(os.path.join(pwd, 'README.rst')).read()
-except:
+except Exception:
     description = ''
 
 setup(
     name='mozsystemmonitor',
     description='Monitor system resource usage.',
     long_description="see https://firefox-source-docs.mozilla.org/mozbase/index.html",
     license='MPL 2.0',
     keywords='mozilla',
--- a/testing/mozbase/moztest/moztest/selftest/fixtures.py
+++ b/testing/mozbase/moztest/moztest/selftest/fixtures.py
@@ -93,23 +93,23 @@ def setup_test_harness(request):
     return inner
 
 
 @pytest.fixture(scope='session')
 def binary():
     """Return a Firefox binary"""
     try:
         return build.get_binary_path()
-    except:
+    except Exception:
         pass
 
     app = 'firefox'
     bindir = os.path.join(os.environ['PYTHON_TEST_TMP'], app)
     if os.path.isdir(bindir):
         try:
             return mozinstall.get_binary(bindir, app_name=app)
-        except:
+        except Exception:
             pass
 
     if 'GECKO_INSTALLER_URL' in os.environ:
         bindir = mozinstall.install(
             os.environ['GECKO_INSTALLER_URL'], os.environ['PYTHON_TEST_TMP'])
         return mozinstall.get_binary(bindir, app_name='firefox')
--- a/testing/mozharness/scripts/android_emulator_unittest.py
+++ b/testing/mozharness/scripts/android_emulator_unittest.py
@@ -100,17 +100,17 @@ class AndroidEmulatorTest(TestingMixin, 
                     self.this_chunk = m.group(2)
         self.sdk_level = None
         self.xre_path = None
 
     def _query_tests_dir(self):
         dirs = self.query_abs_dirs()
         try:
             test_dir = self.config["suite_definitions"][self.test_suite]["testsdir"]
-        except:
+        except Exception:
             test_dir = self.test_suite
         return os.path.join(dirs['abs_test_install_dir'], test_dir)
 
     def query_abs_dirs(self):
         if self.abs_dirs:
             return self.abs_dirs
         abs_dirs = super(AndroidEmulatorTest, self).query_abs_dirs()
         dirs = {}
@@ -174,17 +174,17 @@ class AndroidEmulatorTest(TestingMixin, 
         self.info("wrote dummy %s" % DDMS_FILE)
 
         # Delete emulator auth file, so it doesn't prompt
         AUTH_FILE = os.path.join(os.path.expanduser('~'), '.emulator_console_auth_token')
         if os.path.exists(AUTH_FILE):
             try:
                 os.remove(AUTH_FILE)
                 self.info("deleted %s" % AUTH_FILE)
-            except:
+            except Exception:
                 self.warning("failed to remove %s" % AUTH_FILE)
 
         avd_path = os.path.join(avd_home_dir, 'avd')
         if os.path.exists(avd_path):
             env['ANDROID_AVD_HOME'] = avd_path
             self.info("Found avds at %s" % avd_path)
         else:
             self.warning("AVDs missing? Not found at %s" % avd_path)
@@ -771,17 +771,17 @@ class AndroidEmulatorTest(TestingMixin, 
         minidump = self.query_minidump_stackwalk()
         for (verify_suite, suite) in suites:
             self.test_suite = suite
 
             cmd = self._build_command()
 
             try:
                 cwd = self._query_tests_dir()
-            except:
+            except Exception:
                 self.fatal("Don't know how to run --test-suite '%s'!" % self.test_suite)
             env = self.query_env()
             if minidump:
                 env['MINIDUMP_STACKWALK'] = minidump
             env['MOZ_UPLOAD_DIR'] = self.query_abs_dirs()['abs_blob_upload_dir']
             env['MINIDUMP_SAVE_PATH'] = self.query_abs_dirs()['abs_blob_upload_dir']
             env['RUST_BACKTRACE'] = 'full'
 
--- a/testing/mozharness/scripts/configtest.py
+++ b/testing/mozharness/scripts/configtest.py
@@ -115,17 +115,17 @@ class ConfigTest(BaseScript):
         for config_file in config_files:
             if config_file.endswith(".py"):
                 filecount[0] += 1
                 self.info("Testing %s." % config_file)
                 global_dict = {}
                 local_dict = {}
                 try:
                     execfile(config_file, global_dict, local_dict)
-                except:
+                except Exception:
                     self.add_summary("%s is invalid python." % config_file,
                                      level="error")
                     self.error(pprint.pformat(sys.exc_info()[1]))
                 else:
                     if 'config' in local_dict and isinstance(local_dict['config'], dict):
                         self.info("Good.")
                         filecount[1] += 1
                     else:
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -749,27 +749,27 @@ class DesktopUnittest(TestingMixin, Merc
                 f.write("\nDisk usage (/): %s\n" % str(psutil.disk_usage(os.path.sep)))
                 if not self._is_windows():
                     # bug 1417189: frequent errors querying users on Windows
                     f.write("\nUsers: %s\n" % str(psutil.users()))
                 f.write("\nNetwork connections:\n")
                 try:
                     for nc in psutil.net_connections():
                         f.write("  %s\n" % str(nc))
-                except:
+                except Exception:
                     f.write("Exception getting network info: %s\n" % sys.exc_info()[0])
                 f.write("\nProcesses:\n")
                 try:
                     for p in psutil.process_iter():
                         ctime = str(datetime.fromtimestamp(p.create_time()))
                         f.write("  PID %d %s %s created at %s\n" %
                                 (p.pid, p.name(), str(p.cmdline()), ctime))
-                except:
+                except Exception:
                     f.write("Exception getting process info: %s\n" % sys.exc_info()[0])
-        except:
+        except Exception:
             # psutil throws a variety of intermittent exceptions
             self.info("Unable to complete system-info.log: %s" % sys.exc_info()[0])
 
     # pull defined in VCSScript.
     # preflight_run_tests defined in TestingMixin.
 
     def run_tests(self):
         self._remove_xen_clipboard()
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -243,17 +243,17 @@ def run_test_harness(options, args):
         if options.device_ip:
             dm_args['host'] = options.device_ip
             dm_args['port'] = options.device_port
         if options.adb_path:
             dm_args['adbPath'] = options.adb_path
         if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
             dm_args['logLevel'] = logging.DEBUG # noqa python 2 / 3
         dm = devicemanagerADB.DeviceManagerADB(**dm_args)
-    except:
+    except BaseException:
         if options.with_b2g_emulator:
             runner.cleanup()
             runner.wait()
         raise
 
     options.xre_path = os.path.abspath(options.xre_path)
     cppunittests.update_mozinfo()
     progs = cppunittests.extract_unittests_from_args(args,
--- a/testing/talos/INSTALL.py
+++ b/testing/talos/INSTALL.py
@@ -10,17 +10,17 @@ from __future__ import absolute_import
 
 import os
 import subprocess
 import sys
 import urllib2
 
 try:
     from subprocess import check_call as call
-except:
+except ImportError:
     from subprocess import call
 
 # globals
 here = os.path.dirname(os.path.abspath(__file__))
 VIRTUALENV = 'https://raw.github.com/pypa/virtualenv/1.10/virtualenv.py'
 
 
 def which(binary, path=os.environ['PATH']):
--- a/testing/talos/talos/cmanager_linux.py
+++ b/testing/talos/talos/cmanager_linux.py
@@ -166,18 +166,18 @@ class LinuxCounterManager(CounterManager
 
         self._loadCounters()
         self.registerCounters(counters)
 
     def getCounterValue(self, counterName):
         """Returns the last value of the counter 'counterName'"""
         try:
             return self.registeredCounters[counterName][0](self.pidList())
-        except:
+        except Exception:
             return None
 
     def pidList(self):
         """Updates the list of PIDs we're interested in"""
         try:
             return [self.process.pid] + [child.pid
                                          for child in self.process.children()]
-        except:
+        except Exception:
             print("WARNING: problem updating child PID's")
--- a/testing/talos/talos/cmanager_mac.py
+++ b/testing/talos/talos/cmanager_mac.py
@@ -16,17 +16,17 @@ def GetProcessData(pid):
       as a list (pid, vsz, rss)
     """
     command = ['ps -o pid,vsize,rss -p'+str(pid)]
     try:
         handle = subprocess.Popen(command, stdout=subprocess.PIPE,
                                   universal_newlines=True, shell=True)
         handle.wait()
         data = handle.stdout.readlines()
-    except:
+    except Exception:
         print("Unexpected error executing '%s': %s", (command, sys.exc_info()))
         raise
 
     # First line is header output should look like:
     # PID      VSZ    RSS
     # 3210    75964    920
     line = data[1]
     line = line.split()
--- a/testing/talos/talos/cmanager_win32.py
+++ b/testing/talos/talos/cmanager_win32.py
@@ -197,17 +197,17 @@ class WinCounterManager(CounterManager):
                     if pdh.PdhAddCounterA(hq, expandedPath, 0,
                                           byref(newhc)) != 0:
                         raise TalosError(
                             "Could not add expanded win32 counter %s"
                             % expandedPath
                         )
                     self.registeredCounters[counter][1].append((newhc,
                                                                 expandedPath))
-                except:
+                except Exception:
                     continue
 
         if oldCounterListLength != len(self.registeredCounters[counter][1]):
             pdh.PdhCollectQueryData(hq)
 
     def getCounterValue(self, counter):
         # Update counter paths, to catch any new child processes that might
         # have been launched since last call.  Then iterate through all
--- a/testing/talos/talos/ffsetup.py
+++ b/testing/talos/talos/ffsetup.py
@@ -270,17 +270,17 @@ class FFSetup(object):
     def __enter__(self):
         LOG.info('Initialising browser for %s test...'
                  % self.test_config['name'])
         self._init_env()
         self._init_profile()
         try:
             if not self.debug_mode and self.test_config['name'] != "damp":
                 self._run_profile()
-        except:
+        except BaseException:
             self.clean()
             raise
         self._init_gecko_profile()
         LOG.info('Browser initialized.')
         # remove ccov files before actual tests start
         if self.browser_config.get('code_coverage', False):
             # if the Firefox build was instrumented for ccov, initializing the browser
             # will have caused ccov to output some gcda files; in order to have valid
--- a/testing/talos/talos/mitmproxy/mitmproxy.py
+++ b/testing/talos/talos/mitmproxy/mitmproxy.py
@@ -16,17 +16,17 @@ from mozlog import get_proxy_logger
 here = os.path.dirname(os.path.realpath(__file__))
 LOG = get_proxy_logger()
 
 # path for mitmproxy certificate, generated auto after mitmdump is started
 # on local machine it is 'HOME', however it is different on production machines
 try:
     DEFAULT_CERT_PATH = os.path.join(os.getenv('HOME'),
                                      '.mitmproxy', 'mitmproxy-ca-cert.cer')
-except:
+except Exception:
     DEFAULT_CERT_PATH = os.path.join(os.getenv('HOMEDRIVE'), os.getenv('HOMEPATH'),
                                      '.mitmproxy', 'mitmproxy-ca-cert.cer')
 
 MITMPROXY_SETTINGS = '''// Start with a comment
 // Load up mitmproxy cert
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
@@ -80,17 +80,17 @@ def is_mitmproxy_cert_installed(browser_
         certificate = _read_certificate(DEFAULT_CERT_PATH)
         contents = read_autoconfig_file(browser_install)
         if (MITMPROXY_SETTINGS % {'cert': certificate}) in contents:
             LOG.info("Verified mitmproxy CA certificate is installed in Firefox")
         else:
             LOG.info("Firefox autoconfig file contents:")
             LOG.info(contents)
             return False
-    except:
+    except Exception:
         LOG.info("Failed to read Firefox autoconfig file, when verifying CA certificate install")
         return False
     return True
 
 
 def install_mitmproxy_cert(mitmproxy_proc, browser_path, scripts_path):
     """Install the CA certificate generated by mitmproxy, into Firefox"""
     LOG.info("Installing mitmxproxy CA certficate into Firefox")
--- a/testing/talos/talos/profiler/symbolicationRequest.py
+++ b/testing/talos/talos/profiler/symbolicationRequest.py
@@ -96,17 +96,17 @@ class SymbolicationRequest:
                                   for x in rawRequests["symbolSources"]]
                     for source in sourceList:
                         if source in self.symFileManager\
                                 .sOptions["symbolPaths"]:
                             self.symbolSources.append(source)
                         else:
                             LogTrace("Unrecognized symbol source: " + source)
                             continue
-                except:
+                except Exception:
                     self.symbolSources = []
                     pass
 
             if not self.symbolSources:
                 self.symbolSources.append(
                     self.symFileManager.sOptions["defaultApp"])
                 self.symbolSources.append(
                     self.symFileManager.sOptions["defaultOs"])
--- a/testing/talos/talos/results.py
+++ b/testing/talos/talos/results.py
@@ -47,17 +47,17 @@ class TalosResults(object):
             # print to results.out
             try:
                 _output = output.GraphserverOutput(self)
                 results = _output()
                 _output.output(
                     'file://%s' % os.path.join(os.getcwd(), 'results.out'),
                     results
                 )
-            except:
+            except Exception:
                 pass
             print('\nFAIL: %s' % str(e).replace('\n', '\nRETURN:'))
             raise e
 
 
 class TestResults(object):
     """container object for all test results across cycles"""
 
@@ -498,14 +498,14 @@ class BrowserLogResults(object):
         # this will be shoved into the xperf results as we ignore those
         SCRIPT_DIR = \
             os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
         filename = os.path.join(SCRIPT_DIR, 'mainthread_io.json')
         try:
             contents = open(filename).read()
             counter_results.setdefault('mainthreadio', []).append(contents)
             self.using_xperf = True
-        except:
+        except Exception:
             # silent failure is fine here as we will only see this on tp5n runs
             pass
 
     def responsiveness(self):
         return self.RESULTS_RESPONSIVENESS_REGEX.findall(self.results_raw)
--- a/testing/talos/talos/talos_process.py
+++ b/testing/talos/talos/talos_process.py
@@ -151,17 +151,17 @@ def run_browser(command, minidump_dir, t
     finally:
         # this also handle KeyboardInterrupt
         # ensure early the process is really terminated
         return_code = None
         try:
             return_code = context.kill_process()
             if return_code is None:
                 return_code = proc.wait(1)
-        except:
+        except Exception:
             # Maybe killed by kill_and_get_minidump(), maybe ended?
             LOG.info("Unable to kill process")
             LOG.info(traceback.format_exc())
 
     reader.output.append(
         "__startBeforeLaunchTimestamp%d__endBeforeLaunchTimestamp"
         % first_time)
     reader.output.append(
--- a/testing/talos/talos/ttest.py
+++ b/testing/talos/talos/ttest.py
@@ -208,17 +208,17 @@ class TTest(object):
                     env=setup.env,
                     # start collecting counters as soon as possible
                     on_started=(counter_management.start
                                 if counter_management else None),
                     debug=browser_config['debug'],
                     debugger=browser_config['debugger'],
                     debugger_args=browser_config['debugger_args']
                 )
-            except:
+            except Exception:
                 self.check_for_crashes(browser_config, minidump_dir,
                                        test_config['name'])
                 raise
             finally:
                 if counter_management:
                     counter_management.stop()
 
             if test_config['mainthread']:
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -366,17 +366,17 @@ class XPCShellTestThread(Thread):
 
           On a remote system, this may be overloaded to use a remote path structure.
         """
         if self.interactive or self.singleFile:
             profileDir = os.path.join(gettempdir(), self.profileName, "xpcshellprofile")
             try:
                 # This could be left over from previous runs
                 self.removeDir(profileDir)
-            except:
+            except Exception:
                 pass
             os.makedirs(profileDir)
         else:
             profileDir = mkdtemp(prefix='xpc-profile-', dir=self._rootTempDir)
         self.env["XPCSHELL_TEST_PROFILE_DIR"] = profileDir
         if self.interactive or self.singleFile:
             self.log.info("profile dir is %s" % profileDir)
         return profileDir
@@ -1550,17 +1550,17 @@ class XPCShellTests(object):
         self.shutdownNode()
         # Clean up any slacker directories that might be lying around
         # Some might fail because of windows taking too long to unlock them.
         # We don't do anything if this fails because the test slaves will have
         # their $TEMP dirs cleaned up on reboot anyway.
         for directory in self.cleanup_dir_list:
             try:
                 shutil.rmtree(directory)
-            except:
+            except Exception:
                 self.log.info("%s could not be cleaned up." % directory)
 
         if exceptions:
             self.log.info("Following exceptions were raised:")
             for t in tracebacks:
                 self.log.error(t)
             raise exceptions[0]
 
--- a/toolkit/components/telemetry/parse_histograms.py
+++ b/toolkit/components/telemetry/parse_histograms.py
@@ -469,17 +469,17 @@ associated with the histogram.  Returns 
                 "mozilla::StartupTimeline::MAX_EVENT_ID": 12,
             }
 
             def try_to_coerce_to_number(v):
                 if v in EXPRESSIONS:
                     return EXPRESSIONS[v]
                 try:
                     return eval(v, {})
-                except:
+                except Exception:
                     return v
             for key in [k for k in coerce_fields if k in definition]:
                 definition[key] = try_to_coerce_to_number(definition[key])
             # This handles old "keyed":"true" definitions (bug 1271986).
             if definition.get("keyed", None) == "true":
                 definition["keyed"] = True
 
         def nice_type_name(t):
--- a/tools/lint/eslint/setup_helper.py
+++ b/tools/lint/eslint/setup_helper.py
@@ -392,10 +392,10 @@ def check_node_executables_valid():
 
 def have_winrm():
     # `winrm -h` should print 'winrm version ...' and exit 1
     try:
         p = subprocess.Popen(['winrm.exe', '-h'],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
         return p.wait() == 1 and p.stdout.read().startswith('winrm')
-    except:
+    except Exception:
         return False