Skip to content

Commit 8282d7c

Browse files
committed
Handle when IOCTL_VM_SOCKETS_GET_LOCAL_CID does not exist in "socket"
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.
1 parent 6b982c2 commit 8282d7c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/test/test_socket.py

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
def get_cid():
5050
if fcntl is None:
5151
return None
52+
if not hasattr(socket, 'IOCTL_VM_SOCKETS_GET_LOCAL_CID'):
53+
return None
5254
try:
5355
with open("/dev/vsock", "rb") as f:
5456
r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ")

0 commit comments

Comments
 (0)