summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-20 07:33:40 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-20 07:33:40 (GMT)
commitba9ac5b5c42a9bba54942211a3b00a1c3ce7bb23 (patch)
tree84491ee8c5be973ab45551b7319bb71416946827 /Lib
parent492f0277933fd5714762a99ec99fd7f97d99866a (diff)
downloadcpython-ba9ac5b5c42a9bba54942211a3b00a1c3ce7bb23.zip
cpython-ba9ac5b5c42a9bba54942211a3b00a1c3ce7bb23.tar.gz
cpython-ba9ac5b5c42a9bba54942211a3b00a1c3ce7bb23.tar.bz2
Issue #16261: Converted some bare except statements to except statements
with specified exception type. Original patch by Ramchandra Apte.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/functools.py2
-rw-r--r--Lib/ipaddress.py4
-rw-r--r--Lib/uuid.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/functools.py b/Lib/functools.py
index fb2e4bd..19c25e1 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -23,7 +23,7 @@ from types import MappingProxyType
from weakref import WeakKeyDictionary
try:
from _thread import RLock
-except:
+except ImportError:
class RLock:
'Dummy reentrant lock for builds without threads'
def __enter__(self): pass
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index be1ec52..7469a9d 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -135,7 +135,7 @@ def v4_int_to_packed(address):
"""
try:
return address.to_bytes(4, 'big')
- except:
+ except OverflowError:
raise ValueError("Address negative or too large for IPv4")
@@ -151,7 +151,7 @@ def v6_int_to_packed(address):
"""
try:
return address.to_bytes(16, 'big')
- except:
+ except OverflowError:
raise ValueError("Address negative or too large for IPv6")
diff --git a/Lib/uuid.py b/Lib/uuid.py
index e627573..5c731ec 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -465,7 +465,7 @@ try:
for libname in ['uuid', 'c']:
try:
lib = ctypes.CDLL(ctypes.util.find_library(libname))
- except:
+ except Exception:
continue
if hasattr(lib, 'uuid_generate_random'):
_uuid_generate_random = lib.uuid_generate_random
@@ -607,7 +607,7 @@ def uuid4():
try:
import os
return UUID(bytes=os.urandom(16), version=4)
- except:
+ except Exception:
import random
return UUID(int=random.getrandbits(128), version=4)