You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2009/05/12 04:17:43 UTC
svn commit: r773762 - /incubator/thrift/trunk/lib/py/src/transport/TSocket.py
Author: dreiss
Date: Tue May 12 02:17:43 2009
New Revision: 773762
URL: http://svn.apache.org/viewvc?rev=773762&view=rev
Log:
THRIFT-495. python: Raise a TTransportException if TSocket is not open
Previously, TSocket.write would raise an AttributeError if the transport
had not been opened. A TTransportException with the code set to
NOT_OPEN is more appropriate. The cost of the check should be
negligible, since TSocket.write is already fairly expensive (it does a
system call).
Modified:
incubator/thrift/trunk/lib/py/src/transport/TSocket.py
Modified: incubator/thrift/trunk/lib/py/src/transport/TSocket.py
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/py/src/transport/TSocket.py?rev=773762&r1=773761&r2=773762&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/py/src/transport/TSocket.py (original)
+++ incubator/thrift/trunk/lib/py/src/transport/TSocket.py Tue May 12 02:17:43 2009
@@ -95,6 +95,8 @@
return buff
def write(self, buff):
+ if not self.handle:
+ raise TTransportException(TTransportException.NOT_OPEN, 'Transport not open')
sent = 0
have = len(buff)
while sent < have: