summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-04-01 01:25:34 (GMT)
committerGitHub <noreply@github.com>2020-04-01 01:25:34 (GMT)
commit6acafee247849b39d65dd0d61c6e57a6ffabdc32 (patch)
tree66ab3e00f29bb631c7462e4658f7a28b6f243d83 /Lib/test
parent40e1b04e389f2f6d4d31079d5622fc27af6ebed7 (diff)
downloadcpython-6acafee247849b39d65dd0d61c6e57a6ffabdc32.zip
cpython-6acafee247849b39d65dd0d61c6e57a6ffabdc32.tar.gz
cpython-6acafee247849b39d65dd0d61c6e57a6ffabdc32.tar.bz2
Handle when IOCTL_VM_SOCKETS_GET_LOCAL_CID does not exist in "socket" (GH-19270)
Running `test_socket` or anything that depends on it (like python -m test.pythoninfo) crashes if IOCTL_VM_SOCKETS_GET_LOCAL_CID does not exist in the socket module. Automerge-Triggered-By: @pablogsal (cherry picked from commit 6eb9619c88612565b424be14196a8adae6d51978) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_socket.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 1bf562a..f9370d8 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -50,6 +50,8 @@ except ImportError:
def get_cid():
if fcntl is None:
return None
+ if not hasattr(socket, 'IOCTL_VM_SOCKETS_GET_LOCAL_CID'):
+ return None
try:
with open("/dev/vsock", "rb") as f:
r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ")