Thrift-1604:Python exxception handeling for changes from PEP3110
Client: py
Patch: Jake Farrell
Python PEP 3110 changed exception handling by replacing the ',' with 'as'. This was initially introduced in python 2.6 and in 3.0 the ',' usage is no longer suppported. Since exception handling through out the py lib uses the ',' it will need to be converted over to using the 'as' syntax for exceptions
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1339941 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/server/TServer.py b/lib/py/src/server/TServer.py
index 2f24842..97097cc 100644
--- a/lib/py/src/server/TServer.py
+++ b/lib/py/src/server/TServer.py
@@ -84,7 +84,7 @@
self.processor.process(iprot, oprot)
except TTransport.TTransportException, tx:
pass
- except Exception, x:
+ except Exception as x:
logging.exception(x)
itrans.close()
@@ -108,7 +108,7 @@
t.start()
except KeyboardInterrupt:
raise
- except Exception, x:
+ except Exception as x:
logging.exception(x)
def handle(self, client):
@@ -121,7 +121,7 @@
self.processor.process(iprot, oprot)
except TTransport.TTransportException, tx:
pass
- except Exception, x:
+ except Exception as x:
logging.exception(x)
itrans.close()
@@ -161,7 +161,7 @@
self.processor.process(iprot, oprot)
except TTransport.TTransportException, tx:
pass
- except Exception, x:
+ except Exception as x:
logging.exception(x)
itrans.close()
@@ -174,7 +174,7 @@
t = threading.Thread(target=self.serveThread)
t.setDaemon(self.daemon)
t.start()
- except Exception, x:
+ except Exception as x:
logging.exception(x)
# Pump the socket for clients
@@ -183,7 +183,7 @@
try:
client = self.serverTransport.accept()
self.clients.put(client)
- except Exception, x:
+ except Exception as x:
logging.exception(x)
@@ -208,7 +208,7 @@
def try_close(file):
try:
file.close()
- except IOError, e:
+ except IOError as e:
logging.warning(e, exc_info=True)
self.serverTransport.listen()
@@ -242,7 +242,7 @@
self.processor.process(iprot, oprot)
except TTransport.TTransportException, tx:
pass
- except Exception, e:
+ except Exception as e:
logging.exception(e)
ecode = 1
finally:
@@ -253,7 +253,7 @@
except TTransport.TTransportException, tx:
pass
- except Exception, x:
+ except Exception as x:
logging.exception(x)
def collect_children(self):