mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866)
This commit is contained in:
parent
dccd41e29f
commit
6012f30bef
6 changed files with 58 additions and 5 deletions
|
@ -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
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue