Skip to content

Commit

Permalink
Added is_closed to EnumDescriptor in protobuf python upb
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 486253678
  • Loading branch information
anandolee authored and copybara-github committed Nov 4, 2022
1 parent 0f4fffe commit 7366156
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,12 @@ static PyObject* PyUpb_EnumDescriptor_GetHasOptions(PyObject* _self,
return PyBool_FromLong(upb_EnumDef_HasOptions(self->def));
}

static PyObject* PyUpb_EnumDescriptor_GetIsClosed(PyObject* _self,
void* closure) {
const upb_EnumDef* enumdef = PyUpb_EnumDescriptor_GetDef(_self);
return PyBool_FromLong(upb_EnumDef_IsClosed(enumdef));
}

static PyObject* PyUpb_EnumDescriptor_GetOptions(PyObject* _self,
PyObject* args) {
PyUpb_DescriptorBase* self = (void*)_self;
Expand Down Expand Up @@ -758,6 +764,8 @@ static PyGetSetDef PyUpb_EnumDescriptor_Getters[] = {
{"containing_type", PyUpb_EnumDescriptor_GetContainingType, NULL,
"Containing type"},
{"has_options", PyUpb_EnumDescriptor_GetHasOptions, NULL, "Has Options"},
{"is_closed", PyUpb_EnumDescriptor_GetIsClosed, NULL,
"Checks if the enum is closed"},
{NULL}};

static PyMethodDef PyUpb_EnumDescriptor_Methods[] = {
Expand Down

0 comments on commit 7366156

Please sign in to comment.