diff options
Diffstat (limited to 'Lib/multiprocessing/util.py')
-rw-r--r-- | Lib/multiprocessing/util.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 4bc7782c00..32c7a96d25 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -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 # |