diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-19 01:45:59 +0100 | 
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-19 01:45:59 +0100 | 
| commit | 79a295261a89f67b9d700732e6e7436bfe63e832 (patch) | |
| tree | c2b9b2fee4dccff15b09b722de67953c683fcd32 /Lib/asyncio | |
| parent | 0ee29c2c7fbc7e1b10e153b0cb59d2270347d4f3 (diff) | |
| download | cpython-git-79a295261a89f67b9d700732e6e7436bfe63e832.tar.gz | |
asyncio, Tulip issue 143: UNIX domain methods, fix ResourceWarning and
DeprecationWarning warnings. create_unix_server() closes the socket on any
error, not only on OSError.
Diffstat (limited to 'Lib/asyncio')
| -rw-r--r-- | Lib/asyncio/unix_events.py | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 3a2fd18b2d..faf4c60d5b 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -183,13 +183,12 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):                  raise ValueError(                      'path and sock can not be specified at the same time') +            sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)              try: -                sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)                  sock.setblocking(False)                  yield from self.sock_connect(sock, path) -            except OSError: -                if sock is not None: -                    sock.close() +            except: +                sock.close()                  raise          else: @@ -213,6 +212,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):              try:                  sock.bind(path)              except OSError as exc: +                sock.close()                  if exc.errno == errno.EADDRINUSE:                      # Let's improve the error message by adding                      # with what exact address it occurs.  | 
