Index: third_party/protobuf/conformance/conformance_python.py |
diff --git a/third_party/protobuf/conformance/conformance_python.py b/third_party/protobuf/conformance/conformance_python.py |
index 7ace9b16725c4771891c52fa5e1e6a1aef05653f..a490c8e8e54bd68e26ef4d10a5f4685dff51b2c4 100755 |
--- a/third_party/protobuf/conformance/conformance_python.py |
+++ b/third_party/protobuf/conformance/conformance_python.py |
@@ -38,9 +38,8 @@ See conformance.proto for more information. |
import struct |
import sys |
import os |
-from google.protobuf import json_format |
from google.protobuf import message |
-from google.protobuf import test_messages_proto3_pb2 |
+from google.protobuf import json_format |
import conformance_pb2 |
sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0) |
@@ -53,9 +52,9 @@ class ProtocolError(Exception): |
pass |
def do_test(request): |
- test_message = test_messages_proto3_pb2.TestAllTypes() |
+ test_message = conformance_pb2.TestAllTypes() |
response = conformance_pb2.ConformanceResponse() |
- test_message = test_messages_proto3_pb2.TestAllTypes() |
+ test_message = conformance_pb2.TestAllTypes() |
try: |
if request.WhichOneof('payload') == 'protobuf_payload': |
@@ -68,7 +67,7 @@ def do_test(request): |
elif request.WhichOneof('payload') == 'json_payload': |
try: |
json_format.Parse(request.json_payload, test_message) |
- except Exception as e: |
+ except json_format.ParseError as e: |
response.parse_error = str(e) |
return response |
@@ -82,11 +81,7 @@ def do_test(request): |
response.protobuf_payload = test_message.SerializeToString() |
elif request.requested_output_format == conformance_pb2.JSON: |
- try: |
- response.json_payload = json_format.MessageToJson(test_message) |
- except Exception as e: |
- response.serialize_error = str(e) |
- return response |
+ response.json_payload = json_format.MessageToJson(test_message) |
except Exception as e: |
response.runtime_error = str(e) |