THRIFT-360. python: Make fastbinary skip struct fields with the wrong type
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758071 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/protocol/fastbinary.c b/lib/py/src/protocol/fastbinary.c
index fd20066..50ca169 100644
--- a/lib/py/src/protocol/fastbinary.c
+++ b/lib/py/src/protocol/fastbinary.c
@@ -891,8 +891,12 @@
return false;
}
if (parsedspec.type != type) {
- PyErr_SetString(PyExc_TypeError, "struct field had wrong type while reading");
- return false;
+ if (!skip(input, type)) {
+ PyErr_SetString(PyExc_TypeError, "struct field had wrong type while reading and can't be skipped");
+ return false;
+ } else {
+ continue;
+ }
}
fieldval = decode_val(input, parsedspec.type, parsedspec.typeargs);