[Python-checkins] Handle when IOCTL_VM_SOCKETS_GET_LOCAL_CID does not exist in "socket" (GH-19270)

Pablo Galindo webhook-mailer at python.org
Tue Mar 31 20:48:44 EDT 2020


https://github.com/python/cpython/commit/6eb9619c88612565b424be14196a8adae6d51978
commit: 6eb9619c88612565b424be14196a8adae6d51978
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-03-31T17:48:37-07:00
summary:

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

files:
M Lib/test/test_socket.py

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 64e95ea34b997..6e4e4fe4c3532 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -49,6 +49,8 @@
 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, "    ")



More information about the Python-checkins mailing list