Dear Python developers The test_socket test fails if /proc/modules is existent but not readable by the user (this is for example the case with the grsecurity patchset of the kernel). The method reading /proc/modules is isTipcAvailable(), which is not a test but a guard for other tests. It seems reasonable to return False in the case that /proc/modules is not readable (but existent). The method isTipcAvailable() already returns False if /proc/modules is non existent (but fails to return False if it's not readable). Attached a proposed test. Feel free to remove the EISDIR in case you feel uncomfortable and want a it be a "real" error. The patch should be applied to both Python-2.7 and Python-3.x. Kind regards Here is the inline version of the patch; it's also attached. diff -r 876bee0bd0baLib/test/test_socket.py --- a/Lib/test/test_socket.py Sat Nov 26 14:04:40 2016 -0800 +++ b/Lib/test/test_socket.py Sun Nov 27 17:00:55 2016 +0100 @@ -4779,12 +4779,21 @@ """ if not hasattr(socket, "AF_TIPC"): return False - if not os.path.isfile("/proc/modules"): - return False - with open("/proc/modules") as f: - for line in f: - if line.startswith("tipc "): - return True + try: + f = open("/proc/modules") + except IOError as e: + # 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 (ENOENT, EISDIR, EACCES): + return False + else: + raise + else: + with f: + for line in f: + if line.startswith("tipc "): + return True return False @unittest.skipUnless(isTipcAvailable(),