|
|
@ -454,8 +454,6 @@ err: |
|
|
|
return ok; |
|
|
|
return ok; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyUpb_Message_MergePartialFrom(PyObject*, PyObject*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool PyUpb_Message_InitMessageAttribute(PyObject* _self, PyObject* name, |
|
|
|
static bool PyUpb_Message_InitMessageAttribute(PyObject* _self, PyObject* name, |
|
|
|
PyObject* value) { |
|
|
|
PyObject* value) { |
|
|
|
PyObject* submsg = PyUpb_Message_GetAttr(_self, name); |
|
|
|
PyObject* submsg = PyUpb_Message_GetAttr(_self, name); |
|
|
@ -463,7 +461,7 @@ static bool PyUpb_Message_InitMessageAttribute(PyObject* _self, PyObject* name, |
|
|
|
assert(!PyErr_Occurred()); |
|
|
|
assert(!PyErr_Occurred()); |
|
|
|
bool ok; |
|
|
|
bool ok; |
|
|
|
if (PyUpb_Message_TryCheck(value)) { |
|
|
|
if (PyUpb_Message_TryCheck(value)) { |
|
|
|
PyObject* tmp = PyUpb_Message_MergePartialFrom(submsg, value); |
|
|
|
PyObject* tmp = PyUpb_Message_MergeFrom(submsg, value); |
|
|
|
ok = tmp != NULL; |
|
|
|
ok = tmp != NULL; |
|
|
|
Py_XDECREF(tmp); |
|
|
|
Py_XDECREF(tmp); |
|
|
|
} else if (PyDict_Check(value)) { |
|
|
|
} else if (PyDict_Check(value)) { |
|
|
@ -1197,8 +1195,7 @@ err: |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyUpb_Message_MergeInternal(PyObject* self, PyObject* arg, |
|
|
|
PyObject* PyUpb_Message_MergeFrom(PyObject* self, PyObject* arg) { |
|
|
|
bool check_required) { |
|
|
|
|
|
|
|
if (self->ob_type != arg->ob_type) { |
|
|
|
if (self->ob_type != arg->ob_type) { |
|
|
|
PyErr_Format(PyExc_TypeError, |
|
|
|
PyErr_Format(PyExc_TypeError, |
|
|
|
"Parameter to MergeFrom() must be instance of same class: " |
|
|
|
"Parameter to MergeFrom() must be instance of same class: " |
|
|
@ -1209,9 +1206,7 @@ static PyObject* PyUpb_Message_MergeInternal(PyObject* self, PyObject* arg, |
|
|
|
// OPT: exit if src is empty.
|
|
|
|
// OPT: exit if src is empty.
|
|
|
|
PyObject* subargs = PyTuple_New(0); |
|
|
|
PyObject* subargs = PyTuple_New(0); |
|
|
|
PyObject* serialized = |
|
|
|
PyObject* serialized = |
|
|
|
check_required |
|
|
|
PyUpb_Message_SerializePartialToString(arg, subargs, NULL); |
|
|
|
? PyUpb_Message_SerializeToString(arg, subargs, NULL) |
|
|
|
|
|
|
|
: PyUpb_Message_SerializePartialToString(arg, subargs, NULL); |
|
|
|
|
|
|
|
Py_DECREF(subargs); |
|
|
|
Py_DECREF(subargs); |
|
|
|
if (!serialized) return NULL; |
|
|
|
if (!serialized) return NULL; |
|
|
|
PyObject* ret = PyUpb_Message_MergeFromString(self, serialized); |
|
|
|
PyObject* ret = PyUpb_Message_MergeFromString(self, serialized); |
|
|
@ -1220,14 +1215,6 @@ static PyObject* PyUpb_Message_MergeInternal(PyObject* self, PyObject* arg, |
|
|
|
Py_RETURN_NONE; |
|
|
|
Py_RETURN_NONE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PyObject* PyUpb_Message_MergeFrom(PyObject* self, PyObject* arg) { |
|
|
|
|
|
|
|
return PyUpb_Message_MergeInternal(self, arg, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyUpb_Message_MergePartialFrom(PyObject* self, PyObject* arg) { |
|
|
|
|
|
|
|
return PyUpb_Message_MergeInternal(self, arg, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyUpb_Message_Clear(PyUpb_Message* self); |
|
|
|
static PyObject* PyUpb_Message_Clear(PyUpb_Message* self); |
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyUpb_Message_CopyFrom(PyObject* _self, PyObject* arg) { |
|
|
|
static PyObject* PyUpb_Message_CopyFrom(PyObject* _self, PyObject* arg) { |
|
|
|