diff -r b76d2d8db81f Lib/functools.py --- a/Lib/functools.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/functools.py Wed Jan 09 19:10:26 2013 +0530 @@ -15,7 +15,7 @@ from collections import namedtuple try: from _thread import allocate_lock as Lock -except: +except ImportError: from _dummy_thread import allocate_lock as Lock diff -r b76d2d8db81f Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/idlelib/PyShell.py Wed Jan 09 19:10:26 2013 +0530 @@ -152,7 +152,7 @@ lineno = int(float(text.index("insert"))) try: self.breakpoints.remove(lineno) - except: + except ValueError: pass text.tag_remove("BREAK", "insert linestart",\ "insert lineend +1char") diff -r b76d2d8db81f Lib/ipaddress.py --- a/Lib/ipaddress.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/ipaddress.py Wed Jan 09 19:10:26 2013 +0530 @@ -135,7 +135,7 @@ """ try: return address.to_bytes(4, 'big') - except: + except OverflowError: raise ValueError("Address negative or too large for IPv4") @@ -151,7 +151,7 @@ """ try: return address.to_bytes(16, 'big') - except: + except OverflowError: raise ValueError("Address negative or too large for IPv6") diff -r b76d2d8db81f Lib/test/regrtest.py --- a/Lib/test/regrtest.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/test/regrtest.py Wed Jan 09 19:10:26 2013 +0530 @@ -718,8 +718,7 @@ except KeyboardInterrupt: interrupted = True break - except: - raise + if findleaks: gc.collect() if gc.garbage: @@ -789,8 +788,6 @@ # print a newline separate from the ^C print() break - except: - raise if single: if next_single_test: diff -r b76d2d8db81f Lib/test/subprocessdata/fd_status.py --- a/Lib/test/subprocessdata/fd_status.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/test/subprocessdata/fd_status.py Wed Jan 09 19:10:26 2013 +0530 @@ -6,7 +6,7 @@ try: _MAXFD = os.sysconf("SC_OPEN_MAX") -except: +except ValueError: _MAXFD = 256 if __name__ == "__main__": diff -r b76d2d8db81f Lib/uuid.py --- a/Lib/uuid.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Lib/uuid.py Wed Jan 09 19:10:26 2013 +0530 @@ -421,10 +421,7 @@ # The uuid_generate_* routines are provided by libuuid on at least # Linux and FreeBSD, and provided by libc on Mac OS X. for libname in ['uuid', 'c']: - try: - lib = ctypes.CDLL(ctypes.util.find_library(libname)) - except: - continue + lib = ctypes.CDLL(ctypes.util.find_library(libname)) if hasattr(lib, 'uuid_generate_random'): _uuid_generate_random = lib.uuid_generate_random if hasattr(lib, 'uuid_generate_time'): @@ -562,7 +559,7 @@ try: import os return UUID(bytes=os.urandom(16), version=4) - except: + except NotImplemented: import random bytes = bytes_(random.randrange(256) for i in range(16)) return UUID(bytes=bytes, version=4) diff -r b76d2d8db81f Mac/BuildScript/build-installer.py --- a/Mac/BuildScript/build-installer.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Mac/BuildScript/build-installer.py Wed Jan 09 19:10:26 2013 +0530 @@ -455,7 +455,7 @@ """ try: f = open(configfile, "r") - except: + except OSError: fatal("Framework configuration file not found: %s" % configfile) for l in f: @@ -685,7 +685,7 @@ except: try: os.unlink(fname) - except: + except OSError: pass def verifyThirdPartyFile(url, checksum, fname): diff -r b76d2d8db81f PC/testpy.py --- a/PC/testpy.py Mon Dec 17 13:43:14 2012 +0530 +++ b/PC/testpy.py Wed Jan 09 19:10:26 2013 +0530 @@ -6,14 +6,14 @@ try: import os -except: +except ImportError: print("""Could not import the standard "os" module. Please check your PYTHONPATH environment variable.""") sys.exit(1) try: import symbol -except: +except ImportError: print("""Could not import the standard "symbol" module. If this is a PC, you should add the dos_8x3 directory to your PYTHONPATH.""") sys.exit(1) diff -r b76d2d8db81f Tools/demo/ss1.py --- a/Tools/demo/ss1.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Tools/demo/ss1.py Wed Jan 09 19:10:26 2013 +0530 @@ -266,13 +266,13 @@ def end_int(self, text): try: self.value = int(text) - except: + except TypeError, ValueError: self.value = None def end_long(self, text): try: self.value = int(text) - except: + except TypeError, ValueError: self.value = None def end_double(self, text): diff -r b76d2d8db81f Tools/scripts/eptags.py --- a/Tools/scripts/eptags.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Tools/scripts/eptags.py Wed Jan 09 19:10:26 2013 +0530 @@ -25,7 +25,7 @@ """Append tags found in file named 'filename' to the open file 'outfp'""" try: fp = open(filename, 'r') - except: + except IOError: sys.stderr.write('Cannot open %s\n'%filename) return charno = 0 diff -r b76d2d8db81f Tools/unicode/gencodec.py --- a/Tools/unicode/gencodec.py Mon Dec 17 13:43:14 2012 +0530 +++ b/Tools/unicode/gencodec.py Wed Jan 09 19:10:26 2013 +0530 @@ -127,7 +127,7 @@ return 'None' try: len(t) - except: + except TypeError: return '0x%0*X' % (precision, t) try: return '(' + ', '.join(['0x%0*X' % (precision, item)