summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2012-04-07 11:23:31 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2012-04-07 11:23:31 (GMT)
commit10f383a9376df13635bb53d5885d43297d0022cd (patch)
treec6ffb4eee7fabdaa0ffa87e5f6282e6b7a2e6f37 /Lib/socket.py
parent0f9eec19ee1652a61d4b2e860e599c617d88b707 (diff)
downloadcpython-10f383a9376df13635bb53d5885d43297d0022cd.zip
cpython-10f383a9376df13635bb53d5885d43297d0022cd.tar.gz
cpython-10f383a9376df13635bb53d5885d43297d0022cd.tar.bz2
Issue #14310: inter-process socket duplication for windows
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 8b2d1cd..1378b0f 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -12,6 +12,7 @@ Functions:
socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
+fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
@@ -209,7 +210,6 @@ class socket(_socket.socket):
self._closed = True
return super().detach()
-
def fromfd(fd, family, type, proto=0):
""" fromfd(fd, family, type[, proto]) -> socket object
@@ -219,6 +219,14 @@ def fromfd(fd, family, type, proto=0):
nfd = dup(fd)
return socket(family, type, proto, nfd)
+if hasattr(_socket.socket, "share"):
+ def fromshare(info):
+ """ fromshare(info) -> socket object
+
+ Create a socket object from a the bytes object returned by
+ socket.share(pid).
+ """
+ return socket(0, 0, 0, info)
if hasattr(_socket, "socketpair"):