Remove edition getter from python descriptor APIs

We've never released these, so this is not a breaking change.

PiperOrigin-RevId: 596007719
pull/15301/head
Mike Kruskal 11 months ago committed by Copybara-Service
parent 0ae12df494
commit 3acd85e0a9
  1. 7
      python/descriptor.c
  2. 7
      python/google/protobuf/descriptor.py
  3. 3
      python/google/protobuf/internal/descriptor_test.py
  4. 5
      python/google/protobuf/pyext/descriptor.cc

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

@ -1279,13 +1279,6 @@ class FileDescriptor(DescriptorBase):
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.

@ -539,9 +539,6 @@ class DescriptorTest(unittest.TestCase):
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,

@ -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<FileDescriptorProto>(_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},
};

Loading…
Cancel
Save