fix segfault when clearing an unset oneof in Python

https://github.com/protocolbuffers/protobuf/issues/10461

PiperOrigin-RevId: 472891559
pull/13171/head
Eric Salo 3 years ago committed by Copybara-Service
parent 467e2b5e3b
commit 27f8d367d3
  1. 2
      python/message.c

@ -1361,7 +1361,7 @@ static PyObject* PyUpb_Message_ClearField(PyObject* _self, PyObject* arg) {
}
if (o) f = upb_Message_WhichOneof(self->ptr.msg, o);
PyUpb_Message_DoClearField(_self, f);
if (f) PyUpb_Message_DoClearField(_self, f);
Py_RETURN_NONE;
}

Loading…
Cancel
Save