THRIFT-3646 Fix Python extension build warnings
Client: Python
Patch: Nobuaki Sukegawa
This closes #877
diff --git a/lib/py/src/ext/binary.cpp b/lib/py/src/ext/binary.cpp
index a83899f..85d8d92 100644
--- a/lib/py/src/ext/binary.cpp
+++ b/lib/py/src/ext/binary.cpp
@@ -27,9 +27,6 @@
if (!readByte(b)) {
return false;
}
- if (b == -1) {
- return false;
- }
type = static_cast<TType>(b);
if (type == T_STOP) {
return true;
diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc
index 554ba6e..9c25841 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -101,7 +101,7 @@
return false;
}
if (len != size) {
- PyErr_Format(PyExc_EOFError, "write length mismatch: expected %d got %d", size, len);
+ PyErr_Format(PyExc_EOFError, "write length mismatch: expected %lu got %d", size, len);
return false;
}
return true;
@@ -246,11 +246,11 @@
template <typename Impl>
bool ProtocolBase<Impl>::checkLengthLimit(int32_t len, long limit) {
if (len < 0) {
- PyErr_Format(PyExc_OverflowError, "negative length: %d", limit);
+ PyErr_Format(PyExc_OverflowError, "negative length: %ld", limit);
return false;
}
if (len > limit) {
- PyErr_Format(PyExc_OverflowError, "size exceeded specified limit: %d", limit);
+ PyErr_Format(PyExc_OverflowError, "size exceeded specified limit: %ld", limit);
return false;
}
return true;
diff --git a/lib/py/src/ext/types.h b/lib/py/src/ext/types.h
index 0dd5d96..fd0a197 100644
--- a/lib/py/src/ext/types.h
+++ b/lib/py/src/ext/types.h
@@ -53,6 +53,7 @@
// Stolen out of TProtocol.h.
// It would be a huge pain to have both get this from one place.
enum TType {
+ T_INVALID = -1,
T_STOP = 0,
T_VOID = 1,
T_BOOL = 2,