green.socket: create_connection: UnboundLocalError on Python3
Fixes https://github.com/eventlet/eventlet/issues/123
This commit is contained in:
@@ -53,7 +53,8 @@ def create_connection(address,
|
|||||||
sock.connect(sa)
|
sock.connect(sa)
|
||||||
return sock
|
return sock
|
||||||
|
|
||||||
except error as msg:
|
except error as e:
|
||||||
|
msg = e
|
||||||
if sock is not None:
|
if sock is not None:
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
|
8
tests/socket_test.py
Normal file
8
tests/socket_test.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from eventlet.green import socket
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_connection_error():
|
||||||
|
try:
|
||||||
|
socket.create_connection(('192.0.2.1', 80), timeout=0.1)
|
||||||
|
except (IOError, OSError):
|
||||||
|
pass
|
Reference in New Issue
Block a user