mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #28704: Fix create_unix_server to support Path-like objects
This commit is contained in:
parent
0ed20cdfb7
commit
d7c151871e
2 changed files with 18 additions and 0 deletions
|
@ -39,6 +39,13 @@ def _sighandler_noop(signum, frame):
|
|||
pass
|
||||
|
||||
|
||||
try:
|
||||
_fspath = os.fspath
|
||||
except AttributeError:
|
||||
# Python 3.5 or earlier
|
||||
_fspath = lambda path: path
|
||||
|
||||
|
||||
class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
|
||||
"""Unix event loop.
|
||||
|
||||
|
@ -256,6 +263,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
|
|||
raise ValueError(
|
||||
'path and sock can not be specified at the same time')
|
||||
|
||||
path = _fspath(path)
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
|
||||
# Check for abstract socket. `str` and `bytes` paths are supported.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue