bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866)

This commit is contained in:
Pablo Galindo 2020-03-09 13:48:01 +00:00 committed by GitHub
parent dccd41e29f
commit 6012f30bef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 5 deletions

View file

@ -102,6 +102,29 @@ def log_to_stderr(level=None):
_log_to_stderr = True
return _logger
# Abstract socket support
def _platform_supports_abstract_sockets():
if sys.platform == "linux":
return True
if hasattr(sys, 'getandroidapilevel'):
return True
return False
def is_abstract_socket_namespace(address):
if not address:
return False
if isinstance(address, bytes):
return address[0] == 0
elif isinstance(address, str):
return address[0] == "\0"
raise TypeError('address type of {address!r} unrecognized')
abstract_sockets_supported = _platform_supports_abstract_sockets()
#
# Function returning a temp directory which will be removed on exit
#