Skip to content

Commit 6eb9619

Browse files
authored
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
1 parent afeaea2 commit 6eb9619

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)