Thrift-1784: pep-3110 exception handling
Client: py
Patch: jfarrell
Updates python lib for pep-3110
diff --git a/lib/py/src/transport/TSSLSocket.py b/lib/py/src/transport/TSSLSocket.py
index c01886d..6ad8d50 100644
--- a/lib/py/src/transport/TSSLSocket.py
+++ b/lib/py/src/transport/TSSLSocket.py
@@ -102,13 +102,13 @@
self.handle.settimeout(self._timeout)
try:
self.handle.connect(ip_port)
- except socket.error, e:
+ except socket.error as e:
if res is not res0[-1]:
continue
else:
raise e
break
- except socket.error, e:
+ except socket.error as e:
if self._unix_socket:
message = 'Could not connect to secure socket %s: %s' \
% (self._unix_socket, e)
@@ -213,7 +213,7 @@
client = ssl.wrap_socket(plain_client, certfile=self.certfile,
server_side=True, ssl_version=self.SSL_VERSION,
ciphers=self.ciphers)
- except ssl.SSLError, ssl_exc:
+ except ssl.SSLError as ssl_exc:
# failed handshake/ssl wrap, close socket to client
plain_client.close()
# raise ssl_exc
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py
index 0175bdc..7b564aa 100644
--- a/lib/py/src/transport/TSocket.py
+++ b/lib/py/src/transport/TSocket.py
@@ -86,13 +86,13 @@
self.handle.settimeout(self._timeout)
try:
self.handle.connect(res[4])
- except socket.error, e:
+ except socket.error as e:
if res is not res0[-1]:
continue
else:
raise e
break
- except socket.error, e:
+ except socket.error as e:
if self._unix_socket:
message = 'Could not connect to socket %s' % self._unix_socket
else:
@@ -103,7 +103,7 @@
def read(self, sz):
try:
buff = self.handle.recv(sz)
- except socket.error, e:
+ except socket.error as e:
if (e.args[0] == errno.ECONNRESET and
(sys.platform == 'darwin' or sys.platform.startswith('freebsd'))):
# freebsd and Mach don't follow POSIX semantic of recv
@@ -161,7 +161,7 @@
tmp = socket.socket(res[0], res[1])
try:
tmp.connect(res[4])
- except socket.error, err:
+ except socket.error as err:
eno, message = err.args
if eno == errno.ECONNREFUSED:
os.unlink(res[4])