Skip to content

Commit a49a709

Browse files
anandoleecopybara-github
authored andcommitted
Breaking Change: Remove deprecated UseDeprecatedLegacyJsonFieldConflicts()
https://protobuf.dev/news/2025-09-19/#cpp-remove-apis PiperOrigin-RevId: 845377744
1 parent 4f74970 commit a49a709

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

python/google/protobuf/pyext/descriptor_pool.cc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ static PyDescriptorPool* PyDescriptorPool_NewWithUnderlay(
148148
}
149149

150150
static PyDescriptorPool* PyDescriptorPool_NewWithDatabase(
151-
DescriptorDatabase* database,
152-
bool use_deprecated_legacy_json_field_conflicts) {
151+
DescriptorDatabase* database) {
153152
PyDescriptorPool* cpool = _CreateDescriptorPool();
154153
if (cpool == nullptr) {
155154
return nullptr;
@@ -164,11 +163,6 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase(
164163
pool = new DescriptorPool();
165164
cpool->is_mutable = true;
166165
}
167-
if (use_deprecated_legacy_json_field_conflicts) {
168-
PROTOBUF_IGNORE_DEPRECATION_START
169-
pool->UseDeprecatedLegacyJsonFieldConflicts();
170-
PROTOBUF_IGNORE_DEPRECATION_STOP
171-
}
172166
cpool->pool = pool;
173167
cpool->is_owned = true;
174168

@@ -188,7 +182,6 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase(
188182
// The public DescriptorPool constructor.
189183
static PyObject* New(PyTypeObject* type,
190184
PyObject* args, PyObject* kwargs) {
191-
int use_deprecated_legacy_json_field_conflicts = 0;
192185
static const char* kwlist[] = {"descriptor_db", nullptr};
193186
PyObject* py_database = nullptr;
194187
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O",
@@ -200,7 +193,7 @@ static PyObject* New(PyTypeObject* type,
200193
database = new PyDescriptorDatabase(py_database);
201194
}
202195
return reinterpret_cast<PyObject*>(PyDescriptorPool_NewWithDatabase(
203-
database, use_deprecated_legacy_json_field_conflicts));
196+
database));
204197
}
205198

206199
static void Dealloc(PyObject* pself) {

src/google/protobuf/descriptor.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,12 +2459,6 @@ class PROTOBUF_EXPORT DescriptorPool {
24592459
// Disallow [enforce_utf8 = false] in .proto files.
24602460
void DisallowEnforceUtf8() { disallow_enforce_utf8_ = true; }
24612461

2462-
// Use the deprecated legacy behavior for handling JSON field name conflicts.
2463-
ABSL_DEPRECATED("Deprecated treatment of field name conflicts is enabled.")
2464-
void UseDeprecatedLegacyJsonFieldConflicts() {
2465-
deprecated_legacy_json_field_conflicts_ = true;
2466-
}
2467-
24682462

24692463
// For internal use only: Gets a non-const pointer to the generated pool.
24702464
// This is called at static-initialization time only, so thread-safety is

0 commit comments

Comments
 (0)