Rename CMessage -> Message, to make the change in https://github.com/protocolbuffers/upb/pull/617 work as intended.

The previous change did not have the desired effect, because the generated code uses the class named "Message" instead of "CMessage."

There was no real need to use the class "CMessage" instead of "Message."  The new name is simpler and will make the previous change work.

PiperOrigin-RevId: 449309343
pull/13171/head
Joshua Haberman 3 years ago committed by Copybara-Service
parent a30bb1b842
commit 12fffeb9c3
  1. 16
      python/convert.c
  2. 8
      python/convert.h
  3. 8
      python/descriptor.c
  4. 8
      python/descriptor_pool.c
  5. 26
      python/extension_dict.c
  6. 14
      python/map.c
  7. 676
      python/message.c
  8. 48
      python/message.h
  9. 24
      python/repeated.c
  10. 6
      python/unknown_fields.c

@ -66,8 +66,8 @@ PyObject* PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef* f,
return ret;
}
case kUpb_CType_Message:
return PyUpb_CMessage_Get((upb_Message*)val.msg_val,
upb_FieldDef_MessageSubDef(f), arena);
return PyUpb_Message_Get((upb_Message*)val.msg_val,
upb_FieldDef_MessageSubDef(f), arena);
default:
PyErr_Format(PyExc_SystemError,
"Getting a value from a field of unknown type %d",
@ -234,8 +234,8 @@ bool PyUpb_PyToUpb(PyObject* obj, const upb_FieldDef* f, upb_MessageValue* val,
}
}
bool PyUpb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m);
bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m);
// -----------------------------------------------------------------------------
// Equal
@ -263,8 +263,8 @@ bool PyUpb_ValueEq(upb_MessageValue val1, upb_MessageValue val2,
memcmp(val1.str_val.data, val2.str_val.data, val1.str_val.size) ==
0;
case kUpb_CType_Message:
return PyUpb_Message_IsEqual(val1.msg_val, val2.msg_val,
upb_FieldDef_MessageSubDef(f));
return upb_Message_IsEqual(val1.msg_val, val2.msg_val,
upb_FieldDef_MessageSubDef(f));
default:
return false;
}
@ -333,8 +333,8 @@ bool PyUpb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
return true;
}
bool PyUpb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m) {
bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m) {
if (msg1 == msg2) return true;
if (upb_Message_ExtensionCount(msg1) != upb_Message_ExtensionCount(msg2))
return false;

@ -52,12 +52,12 @@ bool PyUpb_PyToUpb(PyObject* obj, const upb_FieldDef* f, upb_MessageValue* val,
bool PyUpb_ValueEq(upb_MessageValue val1, upb_MessageValue val2,
const upb_FieldDef* f);
// Returns true if the given messages (of type `m`) are equal.
bool PyUpb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m);
// Returns true if the two arrays (with element type `f`) are equal.
bool PyUpb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
const upb_FieldDef* f);
// Returns true if the given messages (of type `m`) are equal.
bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
const upb_MessageDef* m);
#endif // PYUPB_CONVERT_H__

@ -132,7 +132,7 @@ static PyObject* PyUpb_DescriptorBase_GetOptions(PyUpb_DescriptorBase* self,
(void)ok;
assert(ok);
self->options = PyUpb_CMessage_Get(opts2, m, py_arena);
self->options = PyUpb_Message_Get(opts2, m, py_arena);
Py_DECREF(py_arena);
}
@ -167,8 +167,8 @@ static PyObject* PyUpb_DescriptorBase_CopyToProto(PyObject* _self,
const upb_MiniTable* layout,
const char* expected_type,
PyObject* py_proto) {
if (!PyUpb_CMessage_Verify(py_proto)) return NULL;
const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(py_proto);
if (!PyUpb_Message_Verify(py_proto)) return NULL;
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(py_proto);
const char* type = upb_MessageDef_FullName(m);
if (strcmp(type, expected_type) != 0) {
PyErr_Format(
@ -180,7 +180,7 @@ static PyObject* PyUpb_DescriptorBase_CopyToProto(PyObject* _self,
PyObject* serialized =
PyUpb_DescriptorBase_GetSerializedProto(_self, func, layout);
if (!serialized) return NULL;
PyObject* ret = PyUpb_CMessage_MergeFromString(py_proto, serialized);
PyObject* ret = PyUpb_Message_MergeFromString(py_proto, serialized);
Py_DECREF(serialized);
return ret;
}

@ -217,7 +217,7 @@ static PyObject* PyUpb_DescriptorPool_DoAddSerializedFile(
goto done;
}
const upb_MessageDef* m = PyUpb_DescriptorPool_GetFileProtoDef();
if (PyUpb_Message_IsEqual(proto, existing, m)) {
if (upb_Message_IsEqual(proto, existing, m)) {
Py_INCREF(Py_None);
result = Py_None;
goto done;
@ -249,8 +249,8 @@ done:
static PyObject* PyUpb_DescriptorPool_DoAdd(PyObject* _self,
PyObject* file_desc) {
if (!PyUpb_CMessage_Verify(file_desc)) return NULL;
const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(file_desc);
if (!PyUpb_Message_Verify(file_desc)) return NULL;
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(file_desc);
const char* file_proto_name =
PYUPB_DESCRIPTOR_PROTO_PACKAGE ".FileDescriptorProto";
if (strcmp(upb_MessageDef_FullName(m), file_proto_name) != 0) {
@ -259,7 +259,7 @@ static PyObject* PyUpb_DescriptorPool_DoAdd(PyObject* _self,
PyObject* subargs = PyTuple_New(0);
if (!subargs) return NULL;
PyObject* serialized =
PyUpb_CMessage_SerializeToString(file_desc, subargs, NULL);
PyUpb_Message_SerializeToString(file_desc, subargs, NULL);
Py_DECREF(subargs);
if (!serialized) return NULL;
PyObject* ret = PyUpb_DescriptorPool_DoAddSerializedFile(_self, serialized);

@ -52,7 +52,7 @@ static PyObject* PyUpb_ExtensionDict_FindExtensionByName(PyObject* _self,
PyObject* key) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const char* name = PyUpb_GetStrData(key);
const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(self->msg);
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(self->msg);
const upb_FileDef* file = upb_MessageDef_File(m);
const upb_DefPool* symtab = upb_FileDef_Pool(file);
const upb_FieldDef* ext = upb_DefPool_FindExtensionByName(symtab, name);
@ -66,7 +66,7 @@ static PyObject* PyUpb_ExtensionDict_FindExtensionByName(PyObject* _self,
static PyObject* PyUpb_ExtensionDict_FindExtensionByNumber(PyObject* _self,
PyObject* arg) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(self->msg);
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(self->msg);
const upb_MiniTable* l = upb_MessageDef_MiniTable(m);
const upb_FileDef* file = upb_MessageDef_File(m);
const upb_DefPool* symtab = upb_FileDef_Pool(file);
@ -83,7 +83,7 @@ static PyObject* PyUpb_ExtensionDict_FindExtensionByNumber(PyObject* _self,
}
static void PyUpb_ExtensionDict_Dealloc(PyUpb_ExtensionDict* self) {
PyUpb_CMessage_ClearExtensionDict(self->msg);
PyUpb_Message_ClearExtensionDict(self->msg);
Py_DECREF(self->msg);
PyUpb_Dealloc(self);
}
@ -107,9 +107,9 @@ static PyObject* PyUpb_ExtensionDict_RichCompare(PyObject* _self,
static int PyUpb_ExtensionDict_Contains(PyObject* _self, PyObject* key) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const upb_FieldDef* f = PyUpb_CMessage_GetExtensionDef(self->msg, key);
const upb_FieldDef* f = PyUpb_Message_GetExtensionDef(self->msg, key);
if (!f) return -1;
upb_Message* msg = PyUpb_CMessage_GetIfReified(self->msg);
upb_Message* msg = PyUpb_Message_GetIfReified(self->msg);
if (!msg) return 0;
if (upb_FieldDef_IsRepeated(f)) {
upb_MessageValue val = upb_Message_Get(msg, f);
@ -121,26 +121,26 @@ static int PyUpb_ExtensionDict_Contains(PyObject* _self, PyObject* key) {
static Py_ssize_t PyUpb_ExtensionDict_Length(PyObject* _self) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
upb_Message* msg = PyUpb_CMessage_GetIfReified(self->msg);
upb_Message* msg = PyUpb_Message_GetIfReified(self->msg);
return msg ? upb_Message_ExtensionCount(msg) : 0;
}
static PyObject* PyUpb_ExtensionDict_Subscript(PyObject* _self, PyObject* key) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const upb_FieldDef* f = PyUpb_CMessage_GetExtensionDef(self->msg, key);
const upb_FieldDef* f = PyUpb_Message_GetExtensionDef(self->msg, key);
if (!f) return NULL;
return PyUpb_CMessage_GetFieldValue(self->msg, f);
return PyUpb_Message_GetFieldValue(self->msg, f);
}
static int PyUpb_ExtensionDict_AssignSubscript(PyObject* _self, PyObject* key,
PyObject* val) {
PyUpb_ExtensionDict* self = (PyUpb_ExtensionDict*)_self;
const upb_FieldDef* f = PyUpb_CMessage_GetExtensionDef(self->msg, key);
const upb_FieldDef* f = PyUpb_Message_GetExtensionDef(self->msg, key);
if (!f) return -1;
if (val) {
return PyUpb_CMessage_SetFieldValue(self->msg, f, val, PyExc_TypeError);
return PyUpb_Message_SetFieldValue(self->msg, f, val, PyExc_TypeError);
} else {
PyUpb_CMessage_DoClearField(self->msg, f);
PyUpb_Message_DoClearField(self->msg, f);
return 0;
}
}
@ -207,9 +207,9 @@ static void PyUpb_ExtensionIterator_Dealloc(void* _self) {
PyObject* PyUpb_ExtensionIterator_IterNext(PyObject* _self) {
PyUpb_ExtensionIterator* self = (PyUpb_ExtensionIterator*)_self;
upb_Message* msg = PyUpb_CMessage_GetIfReified(self->msg);
upb_Message* msg = PyUpb_Message_GetIfReified(self->msg);
if (!msg) return NULL;
const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(self->msg);
const upb_MessageDef* m = PyUpb_Message_GetMsgdef(self->msg);
const upb_DefPool* symtab = upb_FileDef_Pool(upb_MessageDef_File(m));
while (true) {
const upb_FieldDef* f;

@ -72,8 +72,8 @@ static void PyUpb_MapContainer_Dealloc(void* _self) {
PyUpb_MapContainer* self = _self;
Py_DECREF(self->arena);
if (PyUpb_MapContainer_IsStub(self)) {
PyUpb_CMessage_CacheDelete(self->ptr.parent,
PyUpb_MapContainer_GetField(self));
PyUpb_Message_CacheDelete(self->ptr.parent,
PyUpb_MapContainer_GetField(self));
Py_DECREF(self->ptr.parent);
} else {
PyUpb_ObjCache_Delete(self->ptr.map);
@ -92,7 +92,7 @@ PyObject* PyUpb_MapContainer_NewStub(PyObject* parent, const upb_FieldDef* f,
PyObject* arena) {
// We only create stubs when the parent is reified, by convention. However
// this is not an invariant: the parent could become reified at any time.
assert(PyUpb_CMessage_GetIfReified(parent) == NULL);
assert(PyUpb_Message_GetIfReified(parent) == NULL);
PyTypeObject* cls = PyUpb_MapContainer_GetClass(f);
PyUpb_MapContainer* map = (void*)PyType_GenericAlloc(cls, 0);
map->arena = arena;
@ -141,7 +141,7 @@ upb_Map* PyUpb_MapContainer_EnsureReified(PyObject* _self) {
map =
upb_Map_New(arena, upb_FieldDef_CType(key_f), upb_FieldDef_CType(val_f));
upb_MessageValue msgval = {.map_val = map};
PyUpb_CMessage_SetConcreteSubobj(self->ptr.parent, f, msgval);
PyUpb_Message_SetConcreteSubobj(self->ptr.parent, f, msgval);
PyUpb_MapContainer_Reify((PyObject*)self, map);
return map;
}
@ -284,8 +284,8 @@ PyUpb_MapContainer* PyUpb_MapContainer_Check(PyObject* _self) {
return (PyUpb_MapContainer*)_self;
}
int PyUpb_CMessage_InitMapAttributes(PyObject* map, PyObject* value,
const upb_FieldDef* f);
int PyUpb_Message_InitMapAttributes(PyObject* map, PyObject* value,
const upb_FieldDef* f);
static PyObject* PyUpb_MapContainer_MergeFrom(PyObject* _self, PyObject* _arg) {
PyUpb_MapContainer* self = (PyUpb_MapContainer*)_self;
@ -295,7 +295,7 @@ static PyObject* PyUpb_MapContainer_MergeFrom(PyObject* _self, PyObject* _arg) {
return PyErr_Format(PyExc_AttributeError, "Merging of dict is not allowed");
}
if (PyUpb_CMessage_InitMapAttributes(_self, _arg, f) < 0) {
if (PyUpb_Message_InitMapAttributes(_self, _arg, f) < 0) {
return NULL;
}

File diff suppressed because it is too large Load Diff

@ -34,66 +34,66 @@
#include "upb/reflection.h"
// Removes the wrapper object for this field from the unset subobject cache.
void PyUpb_CMessage_CacheDelete(PyObject* _self, const upb_FieldDef* f);
void PyUpb_Message_CacheDelete(PyObject* _self, const upb_FieldDef* f);
// Sets the field value for `f` to `subobj`, evicting the wrapper object from
// the "unset subobject" cache now that real data exists for it. The caller
// must also update the wrapper associated with `f` to point to `subobj` also.
void PyUpb_CMessage_SetConcreteSubobj(PyObject* _self, const upb_FieldDef* f,
upb_MessageValue subobj);
void PyUpb_Message_SetConcreteSubobj(PyObject* _self, const upb_FieldDef* f,
upb_MessageValue subobj);
// Gets a Python wrapper object for message `u_msg` of type `m`, returning a
// cached wrapper if one was previously created. If a new object is created,
// it will reference `arena`, which must own `u_msg`.
PyObject* PyUpb_CMessage_Get(upb_Message* u_msg, const upb_MessageDef* m,
PyObject* arena);
PyObject* PyUpb_Message_Get(upb_Message* u_msg, const upb_MessageDef* m,
PyObject* arena);
// Verifies that a Python object is a message. Sets a TypeError exception and
// returns false on failure.
bool PyUpb_CMessage_Verify(PyObject* self);
bool PyUpb_Message_Verify(PyObject* self);
// Gets the upb_Message* for this message object if the message is reified.
// Otherwise returns NULL.
upb_Message* PyUpb_CMessage_GetIfReified(PyObject* _self);
upb_Message* PyUpb_Message_GetIfReified(PyObject* _self);
// Returns the `upb_MessageDef` for a given CMessage.
const upb_MessageDef* PyUpb_CMessage_GetMsgdef(PyObject* self);
// Returns the `upb_MessageDef` for a given Message.
const upb_MessageDef* PyUpb_Message_GetMsgdef(PyObject* self);
// Functions that match the corresponding methods on the message object.
PyObject* PyUpb_CMessage_MergeFrom(PyObject* self, PyObject* arg);
PyObject* PyUpb_CMessage_MergeFromString(PyObject* self, PyObject* arg);
PyObject* PyUpb_CMessage_SerializeToString(PyObject* self, PyObject* args,
PyObject* kwargs);
PyObject* PyUpb_Message_MergeFrom(PyObject* self, PyObject* arg);
PyObject* PyUpb_Message_MergeFromString(PyObject* self, PyObject* arg);
PyObject* PyUpb_Message_SerializeToString(PyObject* self, PyObject* args,
PyObject* kwargs);
// Sets fields of the message according to the attribuges in `kwargs`.
int PyUpb_CMessage_InitAttributes(PyObject* _self, PyObject* args,
PyObject* kwargs);
int PyUpb_Message_InitAttributes(PyObject* _self, PyObject* args,
PyObject* kwargs);
// Checks that `key` is a field descriptor for an extension type, and that the
// extendee is this message. Otherwise returns NULL and sets a KeyError.
const upb_FieldDef* PyUpb_CMessage_GetExtensionDef(PyObject* _self,
PyObject* key);
const upb_FieldDef* PyUpb_Message_GetExtensionDef(PyObject* _self,
PyObject* key);
// Clears the given field in this message.
void PyUpb_CMessage_DoClearField(PyObject* _self, const upb_FieldDef* f);
void PyUpb_Message_DoClearField(PyObject* _self, const upb_FieldDef* f);
// Clears the ExtensionDict from the message. The message must have an
// ExtensionDict set.
void PyUpb_CMessage_ClearExtensionDict(PyObject* _self);
void PyUpb_Message_ClearExtensionDict(PyObject* _self);
// Implements the equivalent of getattr(msg, field), once `field` has
// already been resolved to a `upb_FieldDef*`.
PyObject* PyUpb_CMessage_GetFieldValue(PyObject* _self,
const upb_FieldDef* field);
PyObject* PyUpb_Message_GetFieldValue(PyObject* _self,
const upb_FieldDef* field);
// Implements the equivalent of setattr(msg, field, value), once `field` has
// already been resolved to a `upb_FieldDef*`.
int PyUpb_CMessage_SetFieldValue(PyObject* _self, const upb_FieldDef* field,
PyObject* value, PyObject* exc);
int PyUpb_Message_SetFieldValue(PyObject* _self, const upb_FieldDef* field,
PyObject* value, PyObject* exc);
// Returns the version associated with this message. The version will be
// incremented when the message changes.
int PyUpb_CMessage_GetVersion(PyObject* _self);
int PyUpb_Message_GetVersion(PyObject* _self);
// Module-level init.
bool PyUpb_InitMessage(PyObject* m);

@ -129,8 +129,8 @@ upb_Array* PyUpb_RepeatedContainer_EnsureReified(PyObject* _self) {
const upb_FieldDef* f = PyUpb_RepeatedContainer_GetField(self);
upb_Arena* arena = PyUpb_Arena_Get(self->arena);
arr = upb_Array_New(arena, upb_FieldDef_CType(f));
PyUpb_CMessage_SetConcreteSubobj(self->ptr.parent, f,
(upb_MessageValue){.array_val = arr});
PyUpb_Message_SetConcreteSubobj(self->ptr.parent, f,
(upb_MessageValue){.array_val = arr});
PyUpb_RepeatedContainer_Reify((PyObject*)self, arr);
return arr;
}
@ -139,8 +139,8 @@ static void PyUpb_RepeatedContainer_Dealloc(PyObject* _self) {
PyUpb_RepeatedContainer* self = (PyUpb_RepeatedContainer*)_self;
Py_DECREF(self->arena);
if (PyUpb_RepeatedContainer_IsStub(self)) {
PyUpb_CMessage_CacheDelete(self->ptr.parent,
PyUpb_RepeatedContainer_GetField(self));
PyUpb_Message_CacheDelete(self->ptr.parent,
PyUpb_RepeatedContainer_GetField(self));
Py_DECREF(self->ptr.parent);
} else {
PyUpb_ObjCache_Delete(self->ptr.arr);
@ -167,7 +167,7 @@ PyObject* PyUpb_RepeatedContainer_NewStub(PyObject* parent,
PyObject* arena) {
// We only create stubs when the parent is reified, by convention. However
// this is not an invariant: the parent could become reified at any time.
assert(PyUpb_CMessage_GetIfReified(parent) == NULL);
assert(PyUpb_Message_GetIfReified(parent) == NULL);
PyTypeObject* cls = PyUpb_RepeatedContainer_GetClass(f);
PyUpb_RepeatedContainer* repeated = (void*)PyType_GenericAlloc(cls, 0);
repeated->arena = arena;
@ -502,7 +502,7 @@ static bool PyUpb_RepeatedContainer_Assign(PyObject* _self, PyObject* list) {
PyObject* obj = PyList_GetItem(list, i);
upb_MessageValue msgval;
if (submsg) {
msgval.msg_val = PyUpb_CMessage_GetIfReified(obj);
msgval.msg_val = PyUpb_Message_GetIfReified(obj);
assert(msgval.msg_val);
} else {
if (!PyUpb_PyToUpb(obj, f, &msgval, arena)) return false;
@ -580,7 +580,7 @@ static PyObject* PyUpb_RepeatedCompositeContainer_AppendNew(PyObject* _self) {
upb_Message* msg = upb_Message_New(m, arena);
upb_MessageValue msgval = {.msg_val = msg};
upb_Array_Append(arr, msgval, arena);
return PyUpb_CMessage_Get(msg, m, self->arena);
return PyUpb_Message_Get(msg, m, self->arena);
}
PyObject* PyUpb_RepeatedCompositeContainer_Add(PyObject* _self, PyObject* args,
@ -588,7 +588,7 @@ PyObject* PyUpb_RepeatedCompositeContainer_Add(PyObject* _self, PyObject* args,
PyUpb_RepeatedContainer* self = (PyUpb_RepeatedContainer*)_self;
PyObject* py_msg = PyUpb_RepeatedCompositeContainer_AppendNew(_self);
if (!py_msg) return NULL;
if (PyUpb_CMessage_InitAttributes(py_msg, args, kwargs) < 0) {
if (PyUpb_Message_InitAttributes(py_msg, args, kwargs) < 0) {
Py_DECREF(py_msg);
upb_Array_Delete(self->ptr.arr, upb_Array_Size(self->ptr.arr) - 1, 1);
return NULL;
@ -598,10 +598,10 @@ PyObject* PyUpb_RepeatedCompositeContainer_Add(PyObject* _self, PyObject* args,
static PyObject* PyUpb_RepeatedCompositeContainer_Append(PyObject* _self,
PyObject* value) {
if (!PyUpb_CMessage_Verify(value)) return NULL;
if (!PyUpb_Message_Verify(value)) return NULL;
PyObject* py_msg = PyUpb_RepeatedCompositeContainer_AppendNew(_self);
if (!py_msg) return NULL;
PyObject* none = PyUpb_CMessage_MergeFrom(py_msg, value);
PyObject* none = PyUpb_Message_MergeFrom(py_msg, value);
if (!none) {
Py_DECREF(py_msg);
return NULL;
@ -632,8 +632,8 @@ static PyObject* PyUpb_RepeatedContainer_Insert(PyObject* _self,
// Create message.
const upb_MessageDef* m = upb_FieldDef_MessageSubDef(f);
upb_Message* msg = upb_Message_New(m, arena);
PyObject* py_msg = PyUpb_CMessage_Get(msg, m, self->arena);
PyObject* ret = PyUpb_CMessage_MergeFrom(py_msg, value);
PyObject* py_msg = PyUpb_Message_Get(msg, m, self->arena);
PyObject* ret = PyUpb_Message_MergeFrom(py_msg, value);
Py_DECREF(py_msg);
if (!ret) return NULL;
Py_DECREF(ret);

@ -314,9 +314,9 @@ static PyObject* PyUpb_UnknownFieldSet_New(PyTypeObject* type, PyObject* args,
return NULL;
}
if (!PyUpb_CMessage_Verify(py_msg)) return NULL;
if (!PyUpb_Message_Verify(py_msg)) return NULL;
PyUpb_UnknownFieldSet* self = PyUpb_UnknownFieldSet_NewBare();
upb_Message* msg = PyUpb_CMessage_GetIfReified(py_msg);
upb_Message* msg = PyUpb_Message_GetIfReified(py_msg);
if (!msg) return &self->ob_base;
size_t size;
@ -324,7 +324,7 @@ static PyObject* PyUpb_UnknownFieldSet_New(PyTypeObject* type, PyObject* args,
if (size == 0) return &self->ob_base;
const char* end = ptr + size;
const upb_MessageDef* msgdef = PyUpb_CMessage_GetMsgdef(py_msg);
const upb_MessageDef* msgdef = PyUpb_Message_GetMsgdef(py_msg);
bool ok;
if (upb_MessageDef_IsMessageSet(msgdef)) {

Loading…
Cancel
Save