mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merge 3.5 (issue #28399)
This commit is contained in:
commit
88e8aca78d
3 changed files with 21 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue