From b6e43af669f61a37a29d8ff0785455108e6bc29d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 29 Jan 2018 22:37:58 +0100 Subject: bpo-28134: Auto-detect socket values from file descriptor (#1349) Fix socket(fileno=fd) by auto-detecting the socket's family, type, and proto from the file descriptor. The auto-detection can be overruled by passing in family, type, and proto explicitly. Without the fix, all socket except for TCP/IP over IPv4 are basically broken: >>> s = socket.create_connection(('www.python.org', 443)) >>> s >>> socket.socket(fileno=s.fileno()) Signed-off-by: Christian Heimes --- Lib/test/_test_multiprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/test/_test_multiprocessing.py') diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 05166b91ba..1e497a572a 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -4204,7 +4204,7 @@ class TestCloseFds(unittest.TestCase): def close(self, fd): if WIN32: - socket.socket(fileno=fd).close() + socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=fd).close() else: os.close(fd) -- cgit v1.2.1