Automated rollback of commit c4bc23782e.

PiperOrigin-RevId: 540609660
pull/13079/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 5411fc6679
commit 2631490637
  1. 4
      python/google/protobuf/pyext/repeated_scalar_container.cc

@ -57,6 +57,7 @@ namespace repeated_scalar_container {
static int InternalAssignRepeatedField(RepeatedScalarContainer* self,
PyObject* list) {
cmessage::AssureWritable(self->parent);
Message* message = self->parent->message;
message->GetReflection()->ClearField(message, self->parent_field_descriptor);
for (Py_ssize_t i = 0; i < PyList_GET_SIZE(list); ++i) {
@ -589,6 +590,9 @@ static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
if (list == nullptr) {
return nullptr;
}
if (PyList_GET_SIZE(list.get()) == 0) {
Py_RETURN_NONE;
}
ScopedPyObjectPtr m(PyObject_GetAttrString(list.get(), "sort"));
if (m == nullptr) {
return nullptr;

Loading…
Cancel
Save