mirror of
https://github.com/python/cpython.git
synced 2024-11-24 10:24:35 +08:00
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
This commit is contained in:
parent
afeaea2d6e
commit
6eb9619c88
@ -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, " ")
|
||||
|
Loading…
Reference in New Issue
Block a user