From 0faab5fcf3c1a6a512322fca40c91bad98184dce Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 26 Dec 2023 19:24:16 -0800 Subject: [PATCH] Remove edition getter from python descriptor APIS We've never released these, so this is not a breaking change. PiperOrigin-RevId: 593897303 --- python/descriptor.c | 7 ------- python/google/protobuf/descriptor.py | 7 ------- python/google/protobuf/internal/descriptor_test.py | 3 --- python/google/protobuf/pyext/descriptor.cc | 5 ----- 4 files changed, 22 deletions(-) diff --git a/python/descriptor.c b/python/descriptor.c index c5af6dd90e1e..29ba6b304787 100644 --- a/python/descriptor.c +++ b/python/descriptor.c @@ -1367,12 +1367,6 @@ static PyObject* PyUpb_FileDescriptor_GetPublicDependencies(PyObject* _self, return PyUpb_GenericSequence_New(&funcs, self->def, self->pool); } -static PyObject* PyUpb_FileDescriptor_GetEdition(PyObject* _self, - void* closure) { - PyUpb_DescriptorBase* self = (void*)_self; - return PyLong_FromLong(upb_FileDef_Edition(self->def)); -} - static PyObject* PyUpb_FileDescriptor_GetHasOptions(PyObject* _self, void* closure) { PyUpb_DescriptorBase* self = (void*)_self; @@ -1421,7 +1415,6 @@ static PyGetSetDef PyUpb_FileDescriptor_Getters[] = { {"public_dependencies", PyUpb_FileDescriptor_GetPublicDependencies, NULL, "Dependencies"}, {"has_options", PyUpb_FileDescriptor_GetHasOptions, NULL, "Has Options"}, - {"edition", PyUpb_FileDescriptor_GetEdition, (setter)NULL, "Edition"}, {NULL}, }; diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py index 29885ff39587..a1b94b3c660b 100755 --- a/python/google/protobuf/descriptor.py +++ b/python/google/protobuf/descriptor.py @@ -1279,13 +1279,6 @@ def CopyToProto(self, proto): def _parent(self): return None - @property - def edition(self): - # pylint: disable=g-import-not-at-top - from google.protobuf import descriptor_pb2 - - return descriptor_pb2.Edition.Value(self._edition) - def _ParseOptions(message, string): """Parses serialized options. diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py index bf833a4b8ac4..c561a0411c2a 100755 --- a/python/google/protobuf/internal/descriptor_test.py +++ b/python/google/protobuf/internal/descriptor_test.py @@ -539,9 +539,6 @@ def testFileDescriptor(self): self.assertEqual(self.my_file.package, 'protobuf_unittest') self.assertEqual(self.my_file.pool, self.pool) self.assertFalse(self.my_file.has_options) - self.assertEqual( - self.my_file.edition, descriptor_pb2.Edition.EDITION_PROTO2 - ) file_proto = descriptor_pb2.FileDescriptorProto() self.my_file.CopyToProto(file_proto) self.assertEqual(self.my_file.serialized_pb, diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc index 2c5bd1a0fe06..a4a323adfa0a 100644 --- a/python/google/protobuf/pyext/descriptor.cc +++ b/python/google/protobuf/pyext/descriptor.cc @@ -1529,10 +1529,6 @@ static int SetSerializedOptions(PyFileDescriptor *self, PyObject *value, return CheckCalledFromGeneratedFile("_serialized_options"); } -static PyObject* GetEdition(PyFileDescriptor* self, void* closure) { - return PyLong_FromLong(_GetDescriptor(self)->edition()); -} - static PyObject* CopyToProto(PyFileDescriptor *self, PyObject *target) { return CopyToPythonProto(_GetDescriptor(self), target); } @@ -1559,7 +1555,6 @@ static PyGetSetDef Getters[] = { {"_options", (getter) nullptr, (setter)SetOptions, "Options"}, {"_serialized_options", (getter) nullptr, (setter)SetSerializedOptions, "Serialized Options"}, - {"edition", (getter)GetEdition, (setter) nullptr, "Edition"}, {nullptr}, };