upb/python/convert.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2021, Google LLC
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of Google LLC nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "python/convert.h"
29 
30 #include "python/message.h"
31 #include "python/protobuf.h"
32 #include "upb/reflection.h"
33 #include "upb/util/compare.h"
34 
36  PyObject* arena) {
37  switch (upb_FieldDef_CType(f)) {
38  case kUpb_CType_Enum:
39  case kUpb_CType_Int32:
40  return PyLong_FromLong(val.int32_val);
41  case kUpb_CType_Int64:
42  return PyLong_FromLongLong(val.int64_val);
43  case kUpb_CType_UInt32:
44  return PyLong_FromSize_t(val.uint32_val);
45  case kUpb_CType_UInt64:
46  return PyLong_FromUnsignedLongLong(val.uint64_val);
47  case kUpb_CType_Float:
48  return PyFloat_FromDouble(val.float_val);
49  case kUpb_CType_Double:
50  return PyFloat_FromDouble(val.double_val);
51  case kUpb_CType_Bool:
52  return PyBool_FromLong(val.bool_val);
53  case kUpb_CType_Bytes:
54  return PyBytes_FromStringAndSize(val.str_val.data, val.str_val.size);
55  case kUpb_CType_String: {
56  PyObject* ret =
57  PyUnicode_DecodeUTF8(val.str_val.data, val.str_val.size, NULL);
58  // If the string can't be decoded in UTF-8, just return a bytes object
59  // that contains the raw bytes. This can't happen if the value was
60  // assigned using the members of the Python message object, but can happen
61  // if the values were parsed from the wire (binary).
62  if (ret == NULL) {
63  PyErr_Clear();
64  ret = PyBytes_FromStringAndSize(val.str_val.data, val.str_val.size);
65  }
66  return ret;
67  }
68  case kUpb_CType_Message:
71  default:
72  PyErr_Format(PyExc_SystemError,
73  "Getting a value from a field of unknown type %d",
75  return NULL;
76  }
77 }
78 
79 static bool PyUpb_GetInt64(PyObject* obj, int64_t* val) {
80  // We require that the value is either an integer or has an __index__
81  // conversion.
82  obj = PyNumber_Index(obj);
83  if (!obj) return false;
84  // If the value is already a Python long, PyLong_AsLongLong() retrieves it.
85  // Otherwise is converts to integer using __int__.
86  *val = PyLong_AsLongLong(obj);
87  bool ok = true;
88  if (PyErr_Occurred()) {
89  assert(PyErr_ExceptionMatches(PyExc_OverflowError));
90  PyErr_Clear();
91  PyErr_Format(PyExc_ValueError, "Value out of range: %S", obj);
92  ok = false;
93  }
94  Py_DECREF(obj);
95  return ok;
96 }
97 
98 static bool PyUpb_GetUint64(PyObject* obj, uint64_t* val) {
99  // We require that the value is either an integer or has an __index__
100  // conversion.
101  obj = PyNumber_Index(obj);
102  if (!obj) return false;
103  *val = PyLong_AsUnsignedLongLong(obj);
104  bool ok = true;
105  if (PyErr_Occurred()) {
106  assert(PyErr_ExceptionMatches(PyExc_OverflowError));
107  PyErr_Clear();
108  PyErr_Format(PyExc_ValueError, "Value out of range: %S", obj);
109  ok = false;
110  }
111  Py_DECREF(obj);
112  return ok;
113 }
114 
115 static bool PyUpb_GetInt32(PyObject* obj, int32_t* val) {
116  int64_t i64;
117  if (!PyUpb_GetInt64(obj, &i64)) return false;
118  if (i64 < INT32_MIN || i64 > INT32_MAX) {
119  PyErr_Format(PyExc_ValueError, "Value out of range: %S", obj);
120  return false;
121  }
122  *val = i64;
123  return true;
124 }
125 
126 static bool PyUpb_GetUint32(PyObject* obj, uint32_t* val) {
127  uint64_t u64;
128  if (!PyUpb_GetUint64(obj, &u64)) return false;
129  if (u64 > UINT32_MAX) {
130  PyErr_Format(PyExc_ValueError, "Value out of range: %S", obj);
131  return false;
132  }
133  *val = u64;
134  return true;
135 }
136 
137 // If `arena` is specified, copies the string data into the given arena.
138 // Otherwise aliases the given data.
139 static upb_MessageValue PyUpb_MaybeCopyString(const char* ptr, size_t size,
140  upb_Arena* arena) {
142  ret.str_val.size = size;
143  if (arena) {
144  char* buf = upb_Arena_Malloc(arena, size);
145  memcpy(buf, ptr, size);
146  ret.str_val.data = buf;
147  } else {
148  ret.str_val.data = ptr;
149  }
150  return ret;
151 }
152 
153 static bool PyUpb_PyToUpbEnum(PyObject* obj, const upb_EnumDef* e,
154  upb_MessageValue* val) {
155  if (PyUnicode_Check(obj)) {
156  Py_ssize_t size;
157  const char* name = PyUnicode_AsUTF8AndSize(obj, &size);
158  const upb_EnumValueDef* ev =
160  if (!ev) {
161  PyErr_Format(PyExc_ValueError, "unknown enum label \"%s\"", name);
162  return false;
163  }
165  return true;
166  } else {
167  int32_t i32;
168  if (!PyUpb_GetInt32(obj, &i32)) return false;
170  !upb_EnumDef_CheckNumber(e, i32)) {
171  PyErr_Format(PyExc_ValueError, "invalid enumerator %d", (int)i32);
172  return false;
173  }
174  val->int32_val = i32;
175  return true;
176  }
177 }
178 
179 bool PyUpb_PyToUpb(PyObject* obj, const upb_FieldDef* f, upb_MessageValue* val,
180  upb_Arena* arena) {
181  switch (upb_FieldDef_CType(f)) {
182  case kUpb_CType_Enum:
184  case kUpb_CType_Int32:
185  return PyUpb_GetInt32(obj, &val->int32_val);
186  case kUpb_CType_Int64:
187  return PyUpb_GetInt64(obj, &val->int64_val);
188  case kUpb_CType_UInt32:
189  return PyUpb_GetUint32(obj, &val->uint32_val);
190  case kUpb_CType_UInt64:
191  return PyUpb_GetUint64(obj, &val->uint64_val);
192  case kUpb_CType_Float:
193  val->float_val = PyFloat_AsDouble(obj);
194  return !PyErr_Occurred();
195  case kUpb_CType_Double:
196  val->double_val = PyFloat_AsDouble(obj);
197  return !PyErr_Occurred();
198  case kUpb_CType_Bool:
199  val->bool_val = PyLong_AsLong(obj);
200  return !PyErr_Occurred();
201  case kUpb_CType_Bytes: {
202  char* ptr;
203  Py_ssize_t size;
204  if (PyBytes_AsStringAndSize(obj, &ptr, &size) < 0) return false;
206  return true;
207  }
208  case kUpb_CType_String: {
209  Py_ssize_t size;
210  const char* ptr;
211  PyObject* unicode = NULL;
212  if (PyBytes_Check(obj)) {
213  unicode = obj = PyUnicode_FromEncodedObject(obj, "utf-8", NULL);
214  if (!obj) return false;
215  }
216  ptr = PyUnicode_AsUTF8AndSize(obj, &size);
217  if (PyErr_Occurred()) {
218  Py_XDECREF(unicode);
219  return false;
220  }
222  Py_XDECREF(unicode);
223  return true;
224  }
225  case kUpb_CType_Message:
226  PyErr_Format(PyExc_ValueError, "Message objects may not be assigned",
228  return false;
229  default:
230  PyErr_Format(PyExc_SystemError,
231  "Getting a value from a field of unknown type %d",
233  return false;
234  }
235 }
236 
237 bool PyUpb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
238  const upb_MessageDef* m);
239 
240 // -----------------------------------------------------------------------------
241 // Equal
242 // -----------------------------------------------------------------------------
243 
245  const upb_FieldDef* f) {
246  switch (upb_FieldDef_CType(f)) {
247  case kUpb_CType_Bool:
248  return val1.bool_val == val2.bool_val;
249  case kUpb_CType_Int32:
250  case kUpb_CType_UInt32:
251  case kUpb_CType_Enum:
252  return val1.int32_val == val2.int32_val;
253  case kUpb_CType_Int64:
254  case kUpb_CType_UInt64:
255  return val1.int64_val == val2.int64_val;
256  case kUpb_CType_Float:
257  return val1.float_val == val2.float_val;
258  case kUpb_CType_Double:
259  return val1.double_val == val2.double_val;
260  case kUpb_CType_String:
261  case kUpb_CType_Bytes:
262  return val1.str_val.size == val2.str_val.size &&
263  memcmp(val1.str_val.data, val2.str_val.data, val1.str_val.size) ==
264  0;
265  case kUpb_CType_Message:
266  return PyUpb_Message_IsEqual(val1.msg_val, val2.msg_val,
268  default:
269  return false;
270  }
271 }
272 
273 bool PyUpb_Map_IsEqual(const upb_Map* map1, const upb_Map* map2,
274  const upb_FieldDef* f) {
275  assert(upb_FieldDef_IsMap(f));
276  if (map1 == map2) return true;
277 
278  size_t size1 = map1 ? upb_Map_Size(map1) : 0;
279  size_t size2 = map2 ? upb_Map_Size(map2) : 0;
280  if (size1 != size2) return false;
281  if (size1 == 0) return true;
282 
283  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(f);
284  const upb_FieldDef* val_f = upb_MessageDef_Field(entry_m, 1);
285  size_t iter = kUpb_Map_Begin;
286 
287  while (upb_MapIterator_Next(map1, &iter)) {
291  if (!upb_Map_Get(map2, key, &val2)) return false;
292  if (!PyUpb_ValueEq(val1, val2, val_f)) return false;
293  }
294 
295  return true;
296 }
297 
298 static bool PyUpb_ArrayElem_IsEqual(const upb_Array* arr1,
299  const upb_Array* arr2, size_t i,
300  const upb_FieldDef* f) {
301  assert(i < upb_Array_Size(arr1));
302  assert(i < upb_Array_Size(arr2));
305  return PyUpb_ValueEq(val1, val2, f);
306 }
307 
308 bool PyUpb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
309  const upb_FieldDef* f) {
311  if (arr1 == arr2) return true;
312 
313  size_t n1 = arr1 ? upb_Array_Size(arr1) : 0;
314  size_t n2 = arr2 ? upb_Array_Size(arr2) : 0;
315  if (n1 != n2) return false;
316 
317  // Half the length rounded down. Important: the empty list rounds to 0.
318  size_t half = n1 / 2;
319 
320  // Search from the ends-in. We expect differences to more quickly manifest
321  // at the ends than in the middle. If the length is odd we will miss the
322  // middle element.
323  for (size_t i = 0; i < half; i++) {
324  if (!PyUpb_ArrayElem_IsEqual(arr1, arr2, i, f)) return false;
325  if (!PyUpb_ArrayElem_IsEqual(arr1, arr2, n1 - 1 - i, f)) return false;
326  }
327 
328  // For an odd-lengthed list, pick up the middle element.
329  if (n1 & 1) {
330  if (!PyUpb_ArrayElem_IsEqual(arr1, arr2, half, f)) return false;
331  }
332 
333  return true;
334 }
335 
336 bool PyUpb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2,
337  const upb_MessageDef* m) {
338  if (msg1 == msg2) return true;
340  return false;
341 
342  // Compare messages field-by-field. This is slightly tricky, because while
343  // we can iterate over normal fields in a predictable order, the extension
344  // order is unpredictable and may be different between msg1 and msg2.
345  // So we use the following strategy:
346  // 1. Iterate over all msg1 fields (including extensions).
347  // 2. For non-extension fields, we find the corresponding field by simply
348  // using upb_Message_Next(msg2). If the two messages have the same set
349  // of fields, this will yield the same field.
350  // 3. For extension fields, we have to actually search for the corresponding
351  // field, which we do with upb_Message_Get(msg2, ext_f1).
352  // 4. Once iteration over msg1 is complete, we call upb_Message_Next(msg2)
353  // one
354  // final time to verify that we have visited all of msg2's regular fields
355  // (we pass NULL for ext_dict so that iteration will *not* return
356  // extensions).
357  //
358  // We don't need to visit all of msg2's extensions, because we verified up
359  // front that both messages have the same number of extensions.
361  const upb_FieldDef *f1, *f2;
363  size_t iter1 = kUpb_Message_Begin;
364  size_t iter2 = kUpb_Message_Begin;
365  while (upb_Message_Next(msg1, m, symtab, &f1, &val1, &iter1)) {
367  val2 = upb_Message_Get(msg2, f1);
368  } else {
369  if (!upb_Message_Next(msg2, m, NULL, &f2, &val2, &iter2) || f1 != f2) {
370  return false;
371  }
372  }
373 
374  if (upb_FieldDef_IsMap(f1)) {
375  if (!PyUpb_Map_IsEqual(val1.map_val, val2.map_val, f1)) return false;
376  } else if (upb_FieldDef_IsRepeated(f1)) {
377  if (!PyUpb_Array_IsEqual(val1.array_val, val2.array_val, f1)) {
378  return false;
379  }
380  } else {
381  if (!PyUpb_ValueEq(val1, val2, f1)) return false;
382  }
383  }
384 
385  if (upb_Message_Next(msg2, m, NULL, &f2, &val2, &iter2)) return false;
386 
387  size_t usize1, usize2;
388  const char* uf1 = upb_Message_GetUnknown(msg1, &usize1);
389  const char* uf2 = upb_Message_GetUnknown(msg2, &usize2);
390  // 100 is arbitrary, we're trying to prevent stack overflow but it's not
391  // obvious how deep we should allow here.
392  return upb_Message_UnknownFieldsAreEqual(uf1, usize1, uf2, usize2, 100) ==
394 }
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
convert.h
upb_MessageValue::uint32_val
uint32_t uint32_val
Definition: upb/upb/reflection.h:46
obj
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1671
unicode
Definition: bloaty/third_party/re2/re2/unicode.py:1
upb_Message_ExtensionCount
size_t upb_Message_ExtensionCount(const upb_Message *msg)
Definition: msg.c:170
kUpb_CType_String
@ kUpb_CType_String
Definition: upb/upb/upb.h:296
upb_MapIterator_Key
upb_MessageValue upb_MapIterator_Key(const upb_Map *map, size_t iter)
Definition: reflection.c:461
grpc::testing::val1
const char val1[]
Definition: client_context_test_peer_test.cc:34
upb_MessageValue::int64_val
int64_t int64_val
Definition: upb/upb/reflection.h:45
kUpb_CType_UInt32
@ kUpb_CType_UInt32
Definition: upb/upb/upb.h:290
kUpb_CType_Int32
@ kUpb_CType_Int32
Definition: upb/upb/upb.h:289
PyUpb_GetUint64
static bool PyUpb_GetUint64(PyObject *obj, uint64_t *val)
Definition: upb/python/convert.c:98
upb_EnumDef_FindValueByNameWithSize
const upb_EnumValueDef * upb_EnumDef_FindValueByNameWithSize(const upb_EnumDef *def, const char *name, size_t len)
Definition: upb/upb/def.c:409
upb_Map_Size
size_t upb_Map_Size(const upb_Map *map)
Definition: reflection.c:430
kUpb_Map_Begin
#define kUpb_Map_Begin
Definition: upb/upb/upb.h:329
xds_manager.f1
f1
Definition: xds_manager.py:42
upb_StringView::data
const char * data
Definition: upb/upb/upb.h:73
upb_MessageDef
Definition: upb/upb/def.c:100
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
PyUpb_ValueEq
bool PyUpb_ValueEq(upb_MessageValue val1, upb_MessageValue val2, const upb_FieldDef *f)
Definition: upb/python/convert.c:244
kUpb_CType_Bytes
@ kUpb_CType_Bytes
Definition: upb/upb/upb.h:297
PyUpb_UpbToPy
PyObject * PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef *f, PyObject *arena)
Definition: upb/python/convert.c:35
upb_Message_GetUnknown
const char * upb_Message_GetUnknown(const upb_Message *msg, size_t *len)
Definition: msg.c:101
UINT32_MAX
#define UINT32_MAX
Definition: stdint-msvc2008.h:142
upb_MessageValue::str_val
upb_StringView str_val
Definition: upb/upb/reflection.h:51
setup.name
name
Definition: setup.py:542
upb_MessageValue::int32_val
int32_t int32_val
Definition: upb/upb/reflection.h:44
upb_Array_Get
upb_MessageValue upb_Array_Get(const upb_Array *arr, size_t i)
Definition: reflection.c:364
upb_EnumDef_File
const upb_FileDef * upb_EnumDef_File(const upb_EnumDef *e)
Definition: upb/upb/def.c:396
kUpb_UnknownCompareResult_Equal
@ kUpb_UnknownCompareResult_Equal
Definition: upb/upb/util/compare.h:50
kUpb_CType_Int64
@ kUpb_CType_Int64
Definition: upb/upb/upb.h:294
upb_MessageValue::double_val
double double_val
Definition: upb/upb/reflection.h:43
upb_FileDef_Syntax
upb_Syntax upb_FileDef_Syntax(const upb_FileDef *f)
Definition: upb/upb/def.c:924
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
PyUpb_Array_IsEqual
bool PyUpb_Array_IsEqual(const upb_Array *arr1, const upb_Array *arr2, const upb_FieldDef *f)
Definition: upb/python/convert.c:308
upb_MessageValue::bool_val
bool bool_val
Definition: upb/upb/reflection.h:41
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
upb_MessageValue
Definition: upb/upb/reflection.h:40
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
kUpb_Message_Begin
#define kUpb_Message_Begin
Definition: upb/upb/reflection.h:113
upb_FieldDef_IsMap
bool upb_FieldDef_IsMap(const upb_FieldDef *f)
Definition: upb/upb/def.c:659
kUpb_CType_Double
@ kUpb_CType_Double
Definition: upb/upb/upb.h:293
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
PyUpb_PyToUpbEnum
static bool PyUpb_PyToUpbEnum(PyObject *obj, const upb_EnumDef *e, upb_MessageValue *val)
Definition: upb/python/convert.c:153
upb_MapIterator_Next
bool upb_MapIterator_Next(const upb_Map *map, size_t *iter)
Definition: reflection.c:448
upb_EnumDef_CheckNumber
bool upb_EnumDef_CheckNumber(const upb_EnumDef *e, int32_t num)
Definition: upb/upb/def.c:424
upb_StringView::size
size_t size
Definition: upb/upb/upb.h:74
kUpb_Syntax_Proto2
@ kUpb_Syntax_Proto2
Definition: upb/upb/def.h:65
upb_Array
Definition: msg_internal.h:424
upb_Arena_Malloc
UPB_INLINE void * upb_Arena_Malloc(upb_Arena *a, size_t size)
Definition: upb/upb/upb.h:222
PyUpb_MaybeCopyString
static upb_MessageValue PyUpb_MaybeCopyString(const char *ptr, size_t size, upb_Arena *arena)
Definition: upb/python/convert.c:139
grpc::testing::val2
const char val2[]
Definition: client_context_test_peer_test.cc:35
PyUpb_Map_IsEqual
bool PyUpb_Map_IsEqual(const upb_Map *map1, const upb_Map *map2, const upb_FieldDef *f)
Definition: upb/python/convert.c:273
upb_FileDef_Pool
const upb_DefPool * upb_FileDef_Pool(const upb_FileDef *f)
Definition: upb/upb/def.c:993
PyUpb_GetUint32
static bool PyUpb_GetUint32(PyObject *obj, uint32_t *val)
Definition: upb/python/convert.c:126
upb_MessageValue::uint64_val
uint64_t uint64_val
Definition: upb/upb/reflection.h:47
upb_EnumValueDef
Definition: upb/upb/def.c:150
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
half
Definition: passthru_endpoint.cc:53
upb_FieldDef_IsExtension
bool upb_FieldDef_IsExtension(const upb_FieldDef *f)
Definition: upb/upb/def.c:543
reflection.h
upb_Message_Next
bool upb_Message_Next(const upb_Message *msg, const upb_MessageDef *m, const upb_DefPool *ext_pool, const upb_FieldDef **out_f, upb_MessageValue *out_val, size_t *iter)
Definition: reflection.c:245
upb_MessageValue::msg_val
const upb_Message * msg_val
Definition: upb/upb/reflection.h:49
PyUpb_ArrayElem_IsEqual
static bool PyUpb_ArrayElem_IsEqual(const upb_Array *arr1, const upb_Array *arr2, size_t i, const upb_FieldDef *f)
Definition: upb/python/convert.c:298
upb_FieldDef_CType
upb_CType upb_FieldDef_CType(const upb_FieldDef *f)
Definition: upb/upb/def.c:500
protobuf.h
upb_Message
void upb_Message
Definition: msg.h:49
upb_FieldDef_MessageSubDef
const upb_MessageDef * upb_FieldDef_MessageSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:619
upb_FieldDef_EnumSubDef
const upb_EnumDef * upb_FieldDef_EnumSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:623
upb_FieldDef
Definition: upb/upb/def.c:56
upb_Array_Size
size_t upb_Array_Size(const upb_Array *arr)
Definition: reflection.c:362
kUpb_CType_Float
@ kUpb_CType_Float
Definition: upb/upb/upb.h:288
symtab
upb_symtab * symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:774
message.h
PyUpb_GetInt64
static bool PyUpb_GetInt64(PyObject *obj, int64_t *val)
Definition: upb/python/convert.c:79
key
const char * key
Definition: hpack_parser_table.cc:164
PyUpb_GetInt32
static bool PyUpb_GetInt32(PyObject *obj, int32_t *val)
Definition: upb/python/convert.c:115
upb_Message_Get
upb_MessageValue upb_Message_Get(const upb_Message *msg, const upb_FieldDef *f)
Definition: reflection.c:146
upb_FieldDef_IsRepeated
bool upb_FieldDef_IsRepeated(const upb_FieldDef *f)
Definition: upb/upb/def.c:651
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
compare.h
upb_MessageValue::float_val
float float_val
Definition: upb/upb/reflection.h:42
ok
bool ok
Definition: async_end2end_test.cc:197
PyUpb_CMessage_Get
PyObject * PyUpb_CMessage_Get(upb_Message *u_msg, const upb_MessageDef *m, PyObject *arena)
Definition: upb/python/message.c:751
upb_MessageDef_File
const upb_FileDef * upb_MessageDef_File(const upb_MessageDef *m)
Definition: upb/upb/def.c:705
upb_Map_Get
bool upb_Map_Get(const upb_Map *map, upb_MessageValue key, upb_MessageValue *val)
Definition: reflection.c:432
kUpb_CType_Bool
@ kUpb_CType_Bool
Definition: upb/upb/upb.h:287
kUpb_CType_Enum
@ kUpb_CType_Enum
Definition: upb/upb/upb.h:291
upb_EnumDef
Definition: upb/upb/def.c:134
upb_Map
Definition: msg_internal.h:581
iter
Definition: test_winkernel.cpp:47
xds_manager.f2
f2
Definition: xds_manager.py:85
kUpb_CType_UInt64
@ kUpb_CType_UInt64
Definition: upb/upb/upb.h:295
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
upb_Message_UnknownFieldsAreEqual
upb_UnknownCompareResult upb_Message_UnknownFieldsAreEqual(const char *buf1, size_t size1, const char *buf2, size_t size2, int max_depth)
Definition: compare.c:263
upb_MessageDef_Field
const upb_FieldDef * upb_MessageDef_Field(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:828
INT32_MAX
#define INT32_MAX
Definition: stdint-msvc2008.h:137
regress.m
m
Definition: regress/regress.py:25
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
upb_MapIterator_Value
upb_MessageValue upb_MapIterator_Value(const upb_Map *map, size_t iter)
Definition: reflection.c:470
upb_DefPool
Definition: upb/upb/def.c:217
upb_EnumValueDef_Number
int32_t upb_EnumValueDef_Number(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:458
upb_Arena
Definition: upb_internal.h:36
kUpb_CType_Message
@ kUpb_CType_Message
Definition: upb/upb/upb.h:292
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
PyUpb_PyToUpb
bool PyUpb_PyToUpb(PyObject *obj, const upb_FieldDef *f, upb_MessageValue *val, upb_Arena *arena)
Definition: upb/python/convert.c:179
PyUpb_Message_IsEqual
bool PyUpb_Message_IsEqual(const upb_Message *msg1, const upb_Message *msg2, const upb_MessageDef *m)
Definition: upb/python/convert.c:336


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:55