diff options
author | Yury Selivanov <yury@magic.io> | 2016-10-09 16:16:08 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-10-09 16:16:08 (GMT) |
commit | 88e8aca78d71fa917a057e8d60b24f4a364d3248 (patch) | |
tree | 81981ba1a9fbf053b811a83e9cc0fddf47c867e4 /Lib/asyncio | |
parent | 75907bc5b500fa6708c06c88261e5c6fa189f20e (diff) | |
parent | 908d55dd7e395779ed1eb5c96664aca6297fedaa (diff) | |
download | cpython-88e8aca78d71fa917a057e8d60b24f4a364d3248.zip cpython-88e8aca78d71fa917a057e8d60b24f4a364d3248.tar.gz cpython-88e8aca78d71fa917a057e8d60b24f4a364d3248.tar.bz2 |
Merge 3.5 (issue #28399)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/unix_events.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 8524ba9..2843678 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -258,6 +258,17 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + # Check for abstract socket. `str` and `bytes` paths are supported. + if path[0] not in (0, '\x00'): + try: + if stat.S_ISSOCK(os.stat(path).st_mode): + os.remove(path) + except FileNotFoundError: + pass + except OSError as err: + # Directory may have permissions only to create socket. + logger.error('Unable to check or remove stale UNIX socket %r: %r', path, err) + try: sock.bind(path) except OSError as exc: |