Silence deprecated usage

pull/11622/head
Mike Kruskal 2 years ago
parent 6c2d65555f
commit 9ee25ad91d
  1. 7
      python/google/protobuf/pyext/descriptor_pool.cc
  2. 2
      src/google/protobuf/descriptor_unittest.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<char*>( \
@ -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"

@ -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,

Loading…
Cancel
Save