Skip to content

Commit 721a452

Browse files
anandoleecopybara-github
authored andcommitted
Breaking change: Remove deprecated GetDebugString() from protobuf python cpp extension.
cpp extension added the API in #7498 Pure python and upb do not support it and filtered out the test This API does not exists in any other language except C++. PiperOrigin-RevId: 691870623
1 parent f2cf85c commit 721a452

File tree

3 files changed

+0
-19
lines changed

3 files changed

+0
-19
lines changed

python/google/protobuf/internal/descriptor_test.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,6 @@ def testContainingTypeFixups(self):
236236
def testContainingServiceFixups(self):
237237
self.assertEqual(self.my_service, self.my_method.containing_service)
238238

239-
@unittest.skipIf(
240-
api_implementation.Type() == 'python',
241-
'GetDebugString is only available with the cpp implementation',
242-
)
243-
def testGetDebugString(self):
244-
self.assertEqual(self.my_file.GetDebugString(), TEST_FILE_DESCRIPTOR_DEBUG)
245-
246239
def testGetOptions(self):
247240
self.assertEqual(self.my_enum.GetOptions(),
248241
descriptor_pb2.EnumOptions())

python/google/protobuf/pyext/descriptor.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,15 +1512,6 @@ static int SetHasOptions(PyFileDescriptor *self, PyObject *value,
15121512
return CheckCalledFromGeneratedFile("has_options");
15131513
}
15141514

1515-
static PyObject* GetDebugString(PyFileDescriptor* self) {
1516-
PyErr_Warn(nullptr,
1517-
"GetDebugString() API is deprecated. This API only "
1518-
"exists in protobuf c++ and does not exists in pure python, upb "
1519-
"or any other languages. GetDebugString() for python cpp "
1520-
"extension will be removed in Jan 2025");
1521-
return PyString_FromCppString(_GetDescriptor(self)->DebugString());
1522-
}
1523-
15241515
static PyObject* GetOptions(PyFileDescriptor *self) {
15251516
return GetOrBuildOptions(_GetDescriptor(self));
15261517
}
@@ -1569,7 +1560,6 @@ static PyGetSetDef Getters[] = {
15691560
};
15701561

15711562
static PyMethodDef Methods[] = {
1572-
{"GetDebugString", (PyCFunction)GetDebugString, METH_NOARGS},
15731563
{"GetOptions", (PyCFunction)GetOptions, METH_NOARGS},
15741564
{"_GetFeatures", (PyCFunction)GetFeatures, METH_NOARGS},
15751565
{"CopyToProto", (PyCFunction)CopyToProto, METH_O},

python/pb_unit_tests/descriptor_test_wrapper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,5 @@
3535
# Our error message is better.
3636
NewDescriptorTest.testImmutableCppDescriptor.__unittest_expecting_failure__ = True
3737

38-
DescriptorTest.testGetDebugString.__unittest_expecting_failure__ = True
39-
4038
if __name__ == '__main__':
4139
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)