THRIFT-586. python: TSocket incorrectly sets the exception type when an end of file error occurs
TTransportException's type was set to "Transport not open" in some cases, which should
be its message.
Use named arguments and set the type for TTransportException to END_OF_FILE in TSocket#read
and TSocket#write.
reviewer: dreiss
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@818429 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/protocol/TBinaryProtocol.py b/lib/py/src/protocol/TBinaryProtocol.py
index db1a7a4..50c6aa8 100644
--- a/lib/py/src/protocol/TBinaryProtocol.py
+++ b/lib/py/src/protocol/TBinaryProtocol.py
@@ -127,13 +127,13 @@
if sz < 0:
version = sz & TBinaryProtocol.VERSION_MASK
if version != TBinaryProtocol.VERSION_1:
- raise TProtocolException(TProtocolException.BAD_VERSION, 'Bad version in readMessageBegin: %d' % (sz))
+ raise TProtocolException(type=TProtocolException.BAD_VERSION, message='Bad version in readMessageBegin: %d' % (sz))
type = sz & TBinaryProtocol.TYPE_MASK
name = self.readString()
seqid = self.readI32()
else:
if self.strictRead:
- raise TProtocolException(TProtocolException.BAD_VERSION, 'No protocol version header')
+ raise TProtocolException(type=TProtocolException.BAD_VERSION, message='No protocol version header')
name = self.trans.readAll(sz)
type = self.readByte()
seqid = self.readI32()