diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc index 6899e94b44..a1e236ea4f 100644 --- a/python/google/protobuf/pyext/descriptor_pool.cc +++ b/python/google/protobuf/pyext/descriptor_pool.cc @@ -48,6 +48,9 @@ #include "absl/strings/string_view.h" #include "absl/strings/str_replace.h" +// Must be included last. +#include "google/protobuf/port_def.inc" + #define PyString_AsStringAndSize(ob, charpp, sizep) \ (PyUnicode_Check(ob) \ ? ((*(charpp) = const_cast( \ @@ -172,7 +175,9 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase( cpool->is_mutable = true; } if (use_deprecated_legacy_json_field_conflicts) { + PROTOBUF_IGNORE_DEPRECATION_START pool->UseDeprecatedLegacyJsonFieldConflicts(); + PROTOBUF_IGNORE_DEPRECATION_STOP } cpool->pool = pool; cpool->is_owned = true; @@ -826,3 +831,5 @@ PyObject* PyDescriptorPool_FromPool(const DescriptorPool* pool) { } // namespace python } // namespace protobuf } // namespace google + +#include "google/protobuf/port_undef.inc" diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 44c054a8f1..038aa00fcb 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -1277,8 +1277,10 @@ class StylizedFieldNamesTest : public testing::Test { AddExtensionRange(AddMessage(&file, "ExtendableMessage"), 1, 1000); DescriptorProto* message = AddMessage(&file, "TestMessage"); + PROTOBUF_IGNORE_DEPRECATION_START message->mutable_options()->set_deprecated_legacy_json_field_conflicts( true); + PROTOBUF_IGNORE_DEPRECATION_STOP AddField(message, "foo_foo", 1, FieldDescriptorProto::LABEL_OPTIONAL, FieldDescriptorProto::TYPE_INT32); AddField(message, "FooBar", 2, FieldDescriptorProto::LABEL_OPTIONAL,