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