]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #28815: Use new exception subclasses
authorMartin Panter <vadmium+py@gmail.com>
Sun, 8 Jan 2017 00:46:25 +0000 (00:46 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sun, 8 Jan 2017 00:46:25 +0000 (00:46 +0000)
Lib/test/test_socket.py

index ea3ca28a39952cb76f99ac42fe175198d8910c62..70c03f9c468a2155ac6f76f978f58e7fcf3f0b30 100644 (file)
@@ -4719,14 +4719,10 @@ def isTipcAvailable():
         return False
     try:
         f = open("/proc/modules")
-    except IOError as e:
+    except (FileNotFoundError, IsADirectoryError, PermissionError):
         # It's ok if the file does not exist, is a directory or if we
-        # have not the permission to read it. In any other case it's a
-        # real error, so raise it again.
-        if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES):
-            return False
-        else:
-            raise
+        # have not the permission to read it.
+        return False
     with f:
         for line in f:
             if line.startswith("tipc "):