summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-04-01 00:48:37 (GMT)
committerGitHub <noreply@github.com>2020-04-01 00:48:37 (GMT)
commit6eb9619c88612565b424be14196a8adae6d51978 (patch)
treeb295f9ae0dbcd895714d901b46f2f449a9335b9f /Lib
parentafeaea2d6e346f627b24cc9e84e2986a7266a70e (diff)
downloadcpython-6eb9619c88612565b424be14196a8adae6d51978.zip
cpython-6eb9619c88612565b424be14196a8adae6d51978.tar.gz
cpython-6eb9619c88612565b424be14196a8adae6d51978.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
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/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 64e95ea..6e4e4fe 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -49,6 +49,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, " ")