Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7106a51 commit e9ae5f9Copy full SHA for e9ae5f9
1 file changed
Lib/test/test_socket.py
@@ -4717,9 +4717,17 @@ def isTipcAvailable():
4717
"""
4718
if not hasattr(socket, "AF_TIPC"):
4719
return False
4720
- if not os.path.isfile("/proc/modules"):
4721
- return False
4722
- with open("/proc/modules") as f:
+ try:
+ f = open("/proc/modules")
+ except IOError as e:
4723
+ # It's ok if the file does not exist, is a directory or if we
4724
+ # have not the permission to read it. In any other case it's a
4725
+ # real error, so raise it again.
4726
+ if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES):
4727
+ return False
4728
+ else:
4729
+ raise
4730
+ with f:
4731
for line in f:
4732
if line.startswith("tipc "):
4733
return True
0 commit comments