Skip to content

Commit

Permalink
Remove edition getter from python descriptor APIS
Browse files Browse the repository at this point in the history
We've never released these, so this is not a breaking change.

PiperOrigin-RevId: 593897303
  • Loading branch information
mkruskal-google authored and copybara-github committed Dec 27, 2023
1 parent c4a7b03 commit 0faab5f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 22 deletions.
7 changes: 0 additions & 7 deletions python/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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},
};

Expand Down
7 changes: 0 additions & 7 deletions python/google/protobuf/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions python/google/protobuf/internal/descriptor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions python/google/protobuf/pyext/descriptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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},
};

Expand Down

0 comments on commit 0faab5f

Please sign in to comment.