blob: 8027b6b7bc5b768527eb9bb38229da22eeaa89d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 31d4003..7d69688 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -1920,10 +1920,8 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) {
// ctx has an explicit limit set (length of string_view), so we have to
// check we ended at that limit.
if (!ctx.EndedAtLimit()) {
- // TODO(jieluo): Raise error and return NULL instead.
- // b/27494216
- PyErr_Warn(nullptr, "Unexpected end-group tag: Not all data was converted");
- return PyLong_FromLong(data.len - ctx.BytesUntilLimit(ptr));
+ PyErr_Format(DecodeError_class, "Unexpected end-group tag: Not all data was converted");
+ return nullptr;
}
return PyLong_FromLong(data.len);
}
|