cpython: 0d663f758adb (original) (raw)
Mercurial > cpython
changeset 105135:0d663f758adb 3.6
Merge 3.5 (issue #28704) [#28704]
Yury Selivanov yury@magic.io | |
---|---|
date | Tue, 15 Nov 2016 15:27:23 -0500 |
parents | 4d78290b1d8e(current diff)f8207c98eb5e(diff) |
children | c7d2ec49a80b 9c32309e4dec |
files | Lib/asyncio/unix_events.py Misc/NEWS |
diffstat | 3 files changed, 21 insertions(+), 0 deletions(-)[+] [-] Lib/asyncio/unix_events.py 8 Lib/test/test_asyncio/test_unix_events.py 10 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -39,6 +39,13 @@ def _sighandler_noop(signum, frame): pass +try:
+ + class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): """Unix event loop. @@ -256,6 +263,7 @@ class _UnixSelectorEventLoop(selector_ev raise ValueError( 'path and sock can not be specified at the same time')
path = _fspath(path)[](#l1.21) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)[](#l1.22)
# Check for abstract socket. str
and bytes
paths are supported.
--- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -4,6 +4,7 @@ import collections import errno import io import os +import pathlib import signal import socket import stat @@ -251,6 +252,15 @@ class SelectorEventLoopUnixSocketTests(t srv.close() self.loop.run_until_complete(srv.wait_closed())
- @unittest.skipUnless(hasattr(os, 'fspath'), 'no os.fspath')
- def test_create_unix_server_pathlib(self):
with test_utils.unix_socket_path() as path:[](#l2.17)
path = pathlib.Path(path)[](#l2.18)
srv_coro = self.loop.create_unix_server(lambda: None, path)[](#l2.19)
srv = self.loop.run_until_complete(srv_coro)[](#l2.20)
srv.close()[](#l2.21)
self.loop.run_until_complete(srv.wait_closed())[](#l2.22)
+ def test_create_unix_server_existing_path_nonsock(self): with tempfile.NamedTemporaryFile() as file: coro = self.loop.create_unix_server(lambda: None, file.name)