From 5fc5558f6e2a213a1e4160585d762bfe749d63ea Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Tue, 13 Aug 2024 13:52:12 -0700 Subject: [PATCH] Raise warnings for deprecated python cpp extension GetDebugString(). Pure python and upb do not support it and filtered out the test. This API does not exists in any other language(except protobuf c++). GetDebugString() for cpp extension will be removed in Jan 2025 PiperOrigin-RevId: 662640110 --- python/google/protobuf/pyext/descriptor.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc index 91fe832b95..323a8d3ad1 100644 --- a/python/google/protobuf/pyext/descriptor.cc +++ b/python/google/protobuf/pyext/descriptor.cc @@ -1508,6 +1508,11 @@ static int SetHasOptions(PyFileDescriptor *self, PyObject *value, } static PyObject* GetDebugString(PyFileDescriptor* self) { + PyErr_Warn(nullptr, + "GetDebugString() API is deprecated. This API only " + "exists in protobuf c++ and does not exists in pure python, upb " + "or any other languages. GetDebugString() for python cpp " + "extension will be removed in Jan 2025"); return PyString_FromCppString(_GetDescriptor(self)->DebugString()); }