descriptor.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/descriptor.h"
29 
30 #include "python/convert.h"
32 #include "python/descriptor_pool.h"
33 #include "python/message.h"
34 #include "python/protobuf.h"
35 #include "upb/def.h"
36 #include "upb/util/def_to_proto.h"
37 
38 // -----------------------------------------------------------------------------
39 // DescriptorBase
40 // -----------------------------------------------------------------------------
41 
42 // This representation is used by all concrete descriptors.
43 
44 typedef struct {
46  PyObject* pool; // We own a ref.
47  const void* def; // Type depends on the class. Kept alive by "pool".
48  PyObject* options; // NULL if not present or not cached.
50 
51 PyObject* PyUpb_AnyDescriptor_GetPool(PyObject* desc) {
52  PyUpb_DescriptorBase* base = (void*)desc;
53  return base->pool;
54 }
55 
56 const void* PyUpb_AnyDescriptor_GetDef(PyObject* desc) {
57  PyUpb_DescriptorBase* base = (void*)desc;
58  return base->def;
59 }
60 
62  PyUpb_DescriptorType type, const void* def, const upb_FileDef* file) {
64  PyTypeObject* type_obj = state->descriptor_types[type];
65  assert(def);
66 
67  PyUpb_DescriptorBase* base = (void*)PyType_GenericAlloc(type_obj, 0);
69  base->def = def;
70  base->options = NULL;
71 
72  PyUpb_ObjCache_Add(def, &base->ob_base);
73  return base;
74 }
75 
76 // Returns a Python object wrapping |def|, of descriptor type |type|. If a
77 // wrapper was previously created for this def, returns it, otherwise creates a
78 // new wrapper.
80  const void* def,
81  const upb_FileDef* file) {
83 
84  if (!base) {
86  }
87 
88  return &base->ob_base;
89 }
90 
92  PyObject* obj, PyUpb_DescriptorType type) {
94  PyTypeObject* type_obj = state->descriptor_types[type];
95  if (!PyObject_TypeCheck(obj, type_obj)) {
96  PyErr_Format(PyExc_TypeError, "Expected object of type %S, but got %R",
97  type_obj, obj);
98  return NULL;
99  }
100  return (PyUpb_DescriptorBase*)obj;
101 }
102 
104  const upb_Message* opts,
105  const upb_MiniTable* layout,
106  const char* msg_name) {
107  if (!self->options) {
108  // Load descriptors protos if they are not loaded already. We have to do
109  // this lazily, otherwise, it would lead to circular imports.
110  PyObject* mod = PyImport_ImportModule(PYUPB_DESCRIPTOR_MODULE);
111  Py_DECREF(mod);
112 
113  // Find the correct options message.
114  PyObject* default_pool = PyUpb_DescriptorPool_GetDefaultPool();
115  const upb_DefPool* symtab = PyUpb_DescriptorPool_GetSymtab(default_pool);
117  assert(m);
118 
119  // Copy the options message from C to Python using serialize+parse.
120  // We don't wrap the C object directly because there is no guarantee that
121  // the descriptor_pb2 that was loaded at runtime has the same members or
122  // layout as the C types that were compiled in.
123  size_t size;
124  PyObject* py_arena = PyUpb_Arena_New();
125  upb_Arena* arena = PyUpb_Arena_Get(py_arena);
126  char* pb = upb_Encode(opts, layout, 0, arena, &size);
127  upb_Message* opts2 = upb_Message_New(m, arena);
128  assert(opts2);
129  bool ok = upb_Decode(pb, size, opts2, upb_MessageDef_MiniTable(m),
132  (void)ok;
133  assert(ok);
134 
135  self->options = PyUpb_CMessage_Get(opts2, m, py_arena);
136  Py_DECREF(py_arena);
137  }
138 
139  Py_INCREF(self->options);
140  return self->options;
141 }
142 
143 typedef void* PyUpb_ToProto_Func(const void* def, upb_Arena* arena);
144 
146  PyObject* _self, PyUpb_ToProto_Func* func, const upb_MiniTable* layout) {
147  PyUpb_DescriptorBase* self = (void*)_self;
149  if (!arena) PYUPB_RETURN_OOM;
150  upb_Message* proto = func(self->def, arena);
151  if (!proto) goto oom;
152  size_t size;
153  char* pb = upb_Encode(proto, layout, 0, arena, &size);
154  if (!pb) goto oom;
155  PyObject* str = PyBytes_FromStringAndSize(pb, size);
157  return str;
158 
159 oom:
161  PyErr_SetNone(PyExc_MemoryError);
162  return NULL;
163 }
164 
165 static PyObject* PyUpb_DescriptorBase_CopyToProto(PyObject* _self,
167  const upb_MiniTable* layout,
168  const char* expected_type,
169  PyObject* py_proto) {
170  if (!PyUpb_CMessage_Verify(py_proto)) return NULL;
171  const upb_MessageDef* m = PyUpb_CMessage_GetMsgdef(py_proto);
172  const char* type = upb_MessageDef_FullName(m);
173  if (strcmp(type, expected_type) != 0) {
174  PyErr_Format(
175  PyExc_TypeError,
176  "CopyToProto: message is of incorrect type '%s' (expected '%s'", type,
177  expected_type);
178  return NULL;
179  }
180  PyObject* serialized =
182  if (!serialized) return NULL;
183  PyObject* ret = PyUpb_CMessage_MergeFromString(py_proto, serialized);
184  Py_DECREF(serialized);
185  return ret;
186 }
187 
190  Py_DECREF(base->pool);
191  Py_XDECREF(base->options);
193 }
194 
195 #define DESCRIPTOR_BASE_SLOTS \
196  {Py_tp_new, (void*)&PyUpb_Forbidden_New}, { \
197  Py_tp_dealloc, (void*)&PyUpb_DescriptorBase_Dealloc \
198  }
199 
200 // -----------------------------------------------------------------------------
201 // Descriptor
202 // -----------------------------------------------------------------------------
203 
205  assert(m);
208 }
209 
212  assert(ret);
213  return ret;
214 }
215 
216 // The LookupNested*() functions provide name lookup for entities nested inside
217 // a message. This uses the symtab's table, which requires that the symtab is
218 // not being mutated concurrently. We can guarantee this for Python-owned
219 // symtabs, but upb cannot guarantee it in general for an arbitrary
220 // `const upb_MessageDef*`.
221 
223  const char* name) {
224  const upb_FileDef* filedef = upb_MessageDef_File(m);
225  const upb_DefPool* symtab = upb_FileDef_Pool(filedef);
226  PyObject* qname =
227  PyUnicode_FromFormat("%s.%s", upb_MessageDef_FullName(m), name);
229  symtab, PyUnicode_AsUTF8AndSize(qname, NULL));
230  Py_DECREF(qname);
231  return ret;
232 }
233 
235  const char* name) {
236  const upb_FileDef* filedef = upb_MessageDef_File(m);
237  const upb_DefPool* symtab = upb_FileDef_Pool(filedef);
238  PyObject* qname =
239  PyUnicode_FromFormat("%s.%s", upb_MessageDef_FullName(m), name);
240  const upb_EnumDef* ret =
241  upb_DefPool_FindEnumByName(symtab, PyUnicode_AsUTF8AndSize(qname, NULL));
242  Py_DECREF(qname);
243  return ret;
244 }
245 
247  const upb_MessageDef* m, const char* name) {
248  const upb_FileDef* filedef = upb_MessageDef_File(m);
249  const upb_DefPool* symtab = upb_FileDef_Pool(filedef);
250  PyObject* qname =
251  PyUnicode_FromFormat("%s.%s", upb_MessageDef_FullName(m), name);
253  symtab, PyUnicode_AsUTF8AndSize(qname, NULL));
254  Py_DECREF(qname);
255  return ret;
256 }
257 
258 static PyObject* PyUpb_Descriptor_GetExtensionRanges(PyObject* _self,
259  void* closure) {
262  PyObject* range_list = PyList_New(n);
263 
264  for (int i = 0; i < n; i++) {
265  const upb_ExtensionRange* range =
267  PyObject* start = PyLong_FromLong(upb_ExtensionRange_Start(range));
268  PyObject* end = PyLong_FromLong(upb_ExtensionRange_End(range));
269  PyList_SetItem(range_list, i, PyTuple_Pack(2, start, end));
270  }
271 
272  return range_list;
273 }
274 
275 static PyObject* PyUpb_Descriptor_GetExtensions(PyObject* _self,
276  void* closure) {
277  PyUpb_DescriptorBase* self = (void*)_self;
278  static PyUpb_GenericSequence_Funcs funcs = {
282  };
283  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
284 }
285 
286 static PyObject* PyUpb_Descriptor_GetExtensionsByName(PyObject* _self,
287  void* closure) {
288  PyUpb_DescriptorBase* self = (void*)_self;
289  static PyUpb_ByNameMap_Funcs funcs = {
290  {
294  },
296  (void*)&upb_FieldDef_Name,
297  };
298  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
299 }
300 
301 static PyObject* PyUpb_Descriptor_GetEnumTypes(PyObject* _self, void* closure) {
302  PyUpb_DescriptorBase* self = (void*)_self;
303  static PyUpb_GenericSequence_Funcs funcs = {
306  (void*)&PyUpb_EnumDescriptor_Get,
307  };
308  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
309 }
310 
311 static PyObject* PyUpb_Descriptor_GetOneofs(PyObject* _self, void* closure) {
312  PyUpb_DescriptorBase* self = (void*)_self;
313  static PyUpb_GenericSequence_Funcs funcs = {
315  (void*)&upb_MessageDef_Oneof,
317  };
318  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
319 }
320 
321 static PyObject* PyUpb_Descriptor_GetOptions(PyObject* _self, PyObject* args) {
322  PyUpb_DescriptorBase* self = (void*)_self;
324  self, upb_MessageDef_Options(self->def),
326  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".MessageOptions");
327 }
328 
329 static PyObject* PyUpb_Descriptor_CopyToProto(PyObject* _self,
330  PyObject* py_proto) {
334  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".DescriptorProto", py_proto);
335 }
336 
337 static PyObject* PyUpb_Descriptor_EnumValueName(PyObject* _self,
338  PyObject* args) {
339  PyUpb_DescriptorBase* self = (void*)_self;
340  const char* enum_name;
341  int number;
342  if (!PyArg_ParseTuple(args, "si", &enum_name, &number)) return NULL;
343  const upb_EnumDef* e =
344  PyUpb_Descriptor_LookupNestedEnum(self->def, enum_name);
345  if (!e) {
346  PyErr_SetString(PyExc_KeyError, enum_name);
347  return NULL;
348  }
350  if (!ev) {
351  PyErr_Format(PyExc_KeyError, "%d", number);
352  return NULL;
353  }
354  return PyUnicode_FromString(upb_EnumValueDef_Name(ev));
355 }
356 
357 static PyObject* PyUpb_Descriptor_GetFieldsByName(PyObject* _self,
358  void* closure) {
359  PyUpb_DescriptorBase* self = (void*)_self;
360  static PyUpb_ByNameMap_Funcs funcs = {
361  {
363  (void*)&upb_MessageDef_Field,
365  },
367  (void*)&upb_FieldDef_Name,
368  };
369  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
370 }
371 
372 static PyObject* PyUpb_Descriptor_GetFieldsByCamelCaseName(PyObject* _self,
373  void* closure) {
374  PyUpb_DescriptorBase* self = (void*)_self;
375  static PyUpb_ByNameMap_Funcs funcs = {
376  {
378  (void*)&upb_MessageDef_Field,
380  },
382  (void*)&upb_FieldDef_JsonName,
383  };
384  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
385 }
386 
387 static PyObject* PyUpb_Descriptor_GetFieldsByNumber(PyObject* _self,
388  void* closure) {
389  static PyUpb_ByNumberMap_Funcs funcs = {
390  {
392  (void*)&upb_MessageDef_Field,
394  },
396  (void*)&upb_FieldDef_Number,
397  };
398  PyUpb_DescriptorBase* self = (void*)_self;
399  return PyUpb_ByNumberMap_New(&funcs, self->def, self->pool);
400 }
401 
402 static PyObject* PyUpb_Descriptor_GetNestedTypes(PyObject* _self,
403  void* closure) {
404  PyUpb_DescriptorBase* self = (void*)_self;
405  static PyUpb_GenericSequence_Funcs funcs = {
408  (void*)&PyUpb_Descriptor_Get,
409  };
410  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
411 }
412 
413 static PyObject* PyUpb_Descriptor_GetNestedTypesByName(PyObject* _self,
414  void* closure) {
415  PyUpb_DescriptorBase* self = (void*)_self;
416  static PyUpb_ByNameMap_Funcs funcs = {
417  {
420  (void*)&PyUpb_Descriptor_Get,
421  },
423  (void*)&upb_MessageDef_Name,
424  };
425  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
426 }
427 
428 static PyObject* PyUpb_Descriptor_GetContainingType(PyObject* _self,
429  void* closure) {
430  // upb does not natively store the lexical parent of a message type, but we
431  // can derive it with some string manipulation and a lookup.
432  PyUpb_DescriptorBase* self = (void*)_self;
433  const upb_MessageDef* m = self->def;
436  const char* full_name = upb_MessageDef_FullName(m);
437  const char* last_dot = strrchr(full_name, '.');
438  if (!last_dot) Py_RETURN_NONE;
440  symtab, full_name, last_dot - full_name);
441  if (!parent) Py_RETURN_NONE;
442  return PyUpb_Descriptor_Get(parent);
443 }
444 
445 static PyObject* PyUpb_Descriptor_GetEnumTypesByName(PyObject* _self,
446  void* closure) {
447  PyUpb_DescriptorBase* self = (void*)_self;
448  static PyUpb_ByNameMap_Funcs funcs = {
449  {
452  (void*)&PyUpb_EnumDescriptor_Get,
453  },
455  (void*)&upb_EnumDef_Name,
456  };
457  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
458 }
459 
460 static PyObject* PyUpb_Descriptor_GetIsExtendable(PyObject* _self,
461  void* closure) {
462  PyUpb_DescriptorBase* self = (void*)_self;
464  Py_RETURN_TRUE;
465  } else {
466  Py_RETURN_FALSE;
467  }
468 }
469 
470 static PyObject* PyUpb_Descriptor_GetFullName(PyObject* self, void* closure) {
472  return PyUnicode_FromString(upb_MessageDef_FullName(msgdef));
473 }
474 
475 static PyObject* PyUpb_Descriptor_GetConcreteClass(PyObject* self,
476  void* closure) {
479 }
480 
481 static PyObject* PyUpb_Descriptor_GetFile(PyObject* self, void* closure) {
484 }
485 
486 static PyObject* PyUpb_Descriptor_GetFields(PyObject* _self, void* closure) {
487  PyUpb_DescriptorBase* self = (void*)_self;
488  static PyUpb_GenericSequence_Funcs funcs = {
490  (void*)&upb_MessageDef_Field,
492  };
493  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
494 }
495 
496 static PyObject* PyUpb_Descriptor_GetHasOptions(PyObject* _self,
497  void* closure) {
498  PyUpb_DescriptorBase* self = (void*)_self;
499  return PyBool_FromLong(upb_MessageDef_HasOptions(self->def));
500 }
501 
502 static PyObject* PyUpb_Descriptor_GetName(PyObject* self, void* closure) {
504  return PyUnicode_FromString(upb_MessageDef_Name(msgdef));
505 }
506 
507 static PyObject* PyUpb_Descriptor_GetEnumValuesByName(PyObject* _self,
508  void* closure) {
509  // upb does not natively store any table containing all nested values.
510  // Consider:
511  // message M {
512  // enum E1 {
513  // A = 0;
514  // B = 1;
515  // }
516  // enum E2 {
517  // C = 0;
518  // D = 1;
519  // }
520  // }
521  //
522  // In this case, upb stores tables for E1 and E2, but it does not store a
523  // table for M that combines them (it is rarely needed and costs precious
524  // space and time to build).
525  //
526  // To work around this, we build an actual Python dict whenever a user
527  // actually asks for this.
528  PyUpb_DescriptorBase* self = (void*)_self;
529  PyObject* ret = PyDict_New();
530  if (!ret) return NULL;
531  int enum_count = upb_MessageDef_NestedEnumCount(self->def);
532  for (int i = 0; i < enum_count; i++) {
533  const upb_EnumDef* e = upb_MessageDef_NestedEnum(self->def, i);
534  int value_count = upb_EnumDef_ValueCount(e);
535  for (int j = 0; j < value_count; j++) {
536  // Collisions should be impossible here, as uniqueness is checked by
537  // protoc (this is an invariant of the protobuf language). However this
538  // uniqueness constraint is not currently checked by upb/def.c at load
539  // time, so if the user supplies a manually-constructed descriptor that
540  // does not respect this constraint, a collision could be possible and the
541  // last-defined enumerator would win. This could be seen as an argument
542  // for having upb actually build the table at load time, thus checking the
543  // constraint proactively, but upb is always checking a subset of the full
544  // validation performed by C++, and we have to pick and choose the biggest
545  // bang for the buck.
546  const upb_EnumValueDef* ev = upb_EnumDef_Value(e, j);
547  const char* name = upb_EnumValueDef_Name(ev);
548  PyObject* val = PyUpb_EnumValueDescriptor_Get(ev);
549  if (!val || PyDict_SetItemString(ret, name, val) < 0) {
550  Py_XDECREF(val);
551  Py_DECREF(ret);
552  return NULL;
553  }
554  Py_DECREF(val);
555  }
556  }
557  return ret;
558 }
559 
560 static PyObject* PyUpb_Descriptor_GetOneofsByName(PyObject* _self,
561  void* closure) {
562  PyUpb_DescriptorBase* self = (void*)_self;
563  static PyUpb_ByNameMap_Funcs funcs = {
564  {
566  (void*)&upb_MessageDef_Oneof,
568  },
570  (void*)&upb_OneofDef_Name,
571  };
572  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
573 }
574 
575 static PyObject* PyUpb_Descriptor_GetSyntax(PyObject* self, void* closure) {
577  const char* syntax =
578  upb_MessageDef_Syntax(msgdef) == kUpb_Syntax_Proto2 ? "proto2" : "proto3";
579  return PyUnicode_InternFromString(syntax);
580 }
581 
582 static PyGetSetDef PyUpb_Descriptor_Getters[] = {
583  {"name", PyUpb_Descriptor_GetName, NULL, "Last name"},
584  {"full_name", PyUpb_Descriptor_GetFullName, NULL, "Full name"},
585  {"_concrete_class", PyUpb_Descriptor_GetConcreteClass, NULL,
586  "concrete class"},
587  {"file", PyUpb_Descriptor_GetFile, NULL, "File descriptor"},
588  {"fields", PyUpb_Descriptor_GetFields, NULL, "Fields sequence"},
589  {"fields_by_name", PyUpb_Descriptor_GetFieldsByName, NULL,
590  "Fields by name"},
591  {"fields_by_camelcase_name", PyUpb_Descriptor_GetFieldsByCamelCaseName,
592  NULL, "Fields by camelCase name"},
593  {"fields_by_number", PyUpb_Descriptor_GetFieldsByNumber, NULL,
594  "Fields by number"},
595  {"nested_types", PyUpb_Descriptor_GetNestedTypes, NULL,
596  "Nested types sequence"},
597  {"nested_types_by_name", PyUpb_Descriptor_GetNestedTypesByName, NULL,
598  "Nested types by name"},
599  {"extensions", PyUpb_Descriptor_GetExtensions, NULL, "Extensions Sequence"},
600  {"extensions_by_name", PyUpb_Descriptor_GetExtensionsByName, NULL,
601  "Extensions by name"},
602  {"extension_ranges", PyUpb_Descriptor_GetExtensionRanges, NULL,
603  "Extension ranges"},
604  {"enum_types", PyUpb_Descriptor_GetEnumTypes, NULL, "Enum sequence"},
605  {"enum_types_by_name", PyUpb_Descriptor_GetEnumTypesByName, NULL,
606  "Enum types by name"},
607  {"enum_values_by_name", PyUpb_Descriptor_GetEnumValuesByName, NULL,
608  "Enum values by name"},
609  {"oneofs_by_name", PyUpb_Descriptor_GetOneofsByName, NULL,
610  "Oneofs by name"},
611  {"oneofs", PyUpb_Descriptor_GetOneofs, NULL, "Oneofs Sequence"},
612  {"containing_type", PyUpb_Descriptor_GetContainingType, NULL,
613  "Containing type"},
614  {"is_extendable", PyUpb_Descriptor_GetIsExtendable, NULL},
615  {"has_options", PyUpb_Descriptor_GetHasOptions, NULL, "Has Options"},
616  {"syntax", &PyUpb_Descriptor_GetSyntax, NULL, "Syntax"},
617  {NULL}};
618 
619 static PyMethodDef PyUpb_Descriptor_Methods[] = {
620  {"GetOptions", PyUpb_Descriptor_GetOptions, METH_NOARGS},
621  {"CopyToProto", PyUpb_Descriptor_CopyToProto, METH_O},
622  {"EnumValueName", PyUpb_Descriptor_EnumValueName, METH_VARARGS},
623  {NULL}};
624 
625 static PyType_Slot PyUpb_Descriptor_Slots[] = {
627  {Py_tp_methods, PyUpb_Descriptor_Methods},
628  {Py_tp_getset, PyUpb_Descriptor_Getters},
629  {0, NULL}};
630 
631 static PyType_Spec PyUpb_Descriptor_Spec = {
632  PYUPB_MODULE_NAME ".Descriptor", // tp_name
633  sizeof(PyUpb_DescriptorBase), // tp_basicsize
634  0, // tp_itemsize
635  Py_TPFLAGS_DEFAULT, // tp_flags
637 };
638 
639 const upb_MessageDef* PyUpb_Descriptor_GetDef(PyObject* _self) {
640  PyUpb_DescriptorBase* self =
642  return self ? self->def : NULL;
643 }
644 
645 // -----------------------------------------------------------------------------
646 // EnumDescriptor
647 // -----------------------------------------------------------------------------
648 
652 }
653 
654 const upb_EnumDef* PyUpb_EnumDescriptor_GetDef(PyObject* _self) {
655  PyUpb_DescriptorBase* self =
657  return self ? self->def : NULL;
658 }
659 
660 static PyObject* PyUpb_EnumDescriptor_GetFullName(PyObject* self,
661  void* closure) {
663  return PyUnicode_FromString(upb_EnumDef_FullName(enumdef));
664 }
665 
666 static PyObject* PyUpb_EnumDescriptor_GetName(PyObject* self, void* closure) {
668  return PyUnicode_FromString(upb_EnumDef_Name(enumdef));
669 }
670 
671 static PyObject* PyUpb_EnumDescriptor_GetFile(PyObject* self, void* closure) {
674 }
675 
676 static PyObject* PyUpb_EnumDescriptor_GetValues(PyObject* _self,
677  void* closure) {
678  PyUpb_DescriptorBase* self = (void*)_self;
679  static PyUpb_GenericSequence_Funcs funcs = {
680  (void*)&upb_EnumDef_ValueCount,
681  (void*)&upb_EnumDef_Value,
683  };
684  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
685 }
686 
687 static PyObject* PyUpb_EnumDescriptor_GetValuesByName(PyObject* _self,
688  void* closure) {
689  static PyUpb_ByNameMap_Funcs funcs = {
690  {
691  (void*)&upb_EnumDef_ValueCount,
692  (void*)&upb_EnumDef_Value,
694  },
696  (void*)&upb_EnumValueDef_Name,
697  };
698  PyUpb_DescriptorBase* self = (void*)_self;
699  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
700 }
701 
702 static PyObject* PyUpb_EnumDescriptor_GetValuesByNumber(PyObject* _self,
703  void* closure) {
704  static PyUpb_ByNumberMap_Funcs funcs = {
705  {
706  (void*)&upb_EnumDef_ValueCount,
707  (void*)&upb_EnumDef_Value,
709  },
711  (void*)&upb_EnumValueDef_Number,
712  };
713  PyUpb_DescriptorBase* self = (void*)_self;
714  return PyUpb_ByNumberMap_New(&funcs, self->def, self->pool);
715 }
716 
717 static PyObject* PyUpb_EnumDescriptor_GetContainingType(PyObject* _self,
718  void* closure) {
719  PyUpb_DescriptorBase* self = (void*)_self;
721  if (!m) Py_RETURN_NONE;
722  return PyUpb_Descriptor_Get(m);
723 }
724 
725 static PyObject* PyUpb_EnumDescriptor_GetHasOptions(PyObject* _self,
726  void* closure) {
727  PyUpb_DescriptorBase* self = (void*)_self;
728  return PyBool_FromLong(upb_EnumDef_HasOptions(self->def));
729 }
730 
731 static PyObject* PyUpb_EnumDescriptor_GetOptions(PyObject* _self,
732  PyObject* args) {
733  PyUpb_DescriptorBase* self = (void*)_self;
737  ".EnumOptions");
738 }
739 
740 static PyObject* PyUpb_EnumDescriptor_CopyToProto(PyObject* _self,
741  PyObject* py_proto) {
745  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".EnumDescriptorProto", py_proto);
746 }
747 
748 static PyGetSetDef PyUpb_EnumDescriptor_Getters[] = {
749  {"full_name", PyUpb_EnumDescriptor_GetFullName, NULL, "Full name"},
750  {"name", PyUpb_EnumDescriptor_GetName, NULL, "last name"},
751  {"file", PyUpb_EnumDescriptor_GetFile, NULL, "File descriptor"},
752  {"values", PyUpb_EnumDescriptor_GetValues, NULL, "values"},
753  {"values_by_name", PyUpb_EnumDescriptor_GetValuesByName, NULL,
754  "Enum values by name"},
755  {"values_by_number", PyUpb_EnumDescriptor_GetValuesByNumber, NULL,
756  "Enum values by number"},
757  {"containing_type", PyUpb_EnumDescriptor_GetContainingType, NULL,
758  "Containing type"},
759  {"has_options", PyUpb_EnumDescriptor_GetHasOptions, NULL, "Has Options"},
760  {NULL}};
761 
762 static PyMethodDef PyUpb_EnumDescriptor_Methods[] = {
763  {"GetOptions", PyUpb_EnumDescriptor_GetOptions, METH_NOARGS},
764  {"CopyToProto", PyUpb_EnumDescriptor_CopyToProto, METH_O},
765  {NULL}};
766 
767 static PyType_Slot PyUpb_EnumDescriptor_Slots[] = {
769  {Py_tp_methods, PyUpb_EnumDescriptor_Methods},
770  {Py_tp_getset, PyUpb_EnumDescriptor_Getters},
771  {0, NULL}};
772 
773 static PyType_Spec PyUpb_EnumDescriptor_Spec = {
774  PYUPB_MODULE_NAME ".EnumDescriptor", // tp_name
775  sizeof(PyUpb_DescriptorBase), // tp_basicsize
776  0, // tp_itemsize
777  Py_TPFLAGS_DEFAULT, // tp_flags
779 };
780 
781 // -----------------------------------------------------------------------------
782 // EnumValueDescriptor
783 // -----------------------------------------------------------------------------
784 
788 }
789 
790 static PyObject* PyUpb_EnumValueDescriptor_GetName(PyObject* self,
791  void* closure) {
793  return PyUnicode_FromString(upb_EnumValueDef_Name(base->def));
794 }
795 
796 static PyObject* PyUpb_EnumValueDescriptor_GetNumber(PyObject* self,
797  void* closure) {
799  return PyLong_FromLong(upb_EnumValueDef_Number(base->def));
800 }
801 
802 static PyObject* PyUpb_EnumValueDescriptor_GetIndex(PyObject* self,
803  void* closure) {
805  return PyLong_FromLong(upb_EnumValueDef_Index(base->def));
806 }
807 
808 static PyObject* PyUpb_EnumValueDescriptor_GetType(PyObject* self,
809  void* closure) {
812 }
813 
814 static PyObject* PyUpb_EnumValueDescriptor_GetHasOptions(PyObject* _self,
815  void* closure) {
816  PyUpb_DescriptorBase* self = (void*)_self;
817  return PyBool_FromLong(upb_EnumValueDef_HasOptions(self->def));
818 }
819 
820 static PyObject* PyUpb_EnumValueDescriptor_GetOptions(PyObject* _self,
821  PyObject* args) {
822  PyUpb_DescriptorBase* self = (void*)_self;
824  self, upb_EnumValueDef_Options(self->def),
826  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".EnumValueOptions");
827 }
828 
829 static PyGetSetDef PyUpb_EnumValueDescriptor_Getters[] = {
830  {"name", PyUpb_EnumValueDescriptor_GetName, NULL, "name"},
831  {"number", PyUpb_EnumValueDescriptor_GetNumber, NULL, "number"},
832  {"index", PyUpb_EnumValueDescriptor_GetIndex, NULL, "index"},
833  {"type", PyUpb_EnumValueDescriptor_GetType, NULL, "index"},
834  {"has_options", PyUpb_EnumValueDescriptor_GetHasOptions, NULL,
835  "Has Options"},
836  {NULL}};
837 
838 static PyMethodDef PyUpb_EnumValueDescriptor_Methods[] = {
839  {
840  "GetOptions",
842  METH_NOARGS,
843  },
844  {NULL}};
845 
846 static PyType_Slot PyUpb_EnumValueDescriptor_Slots[] = {
848  {Py_tp_methods, PyUpb_EnumValueDescriptor_Methods},
849  {Py_tp_getset, PyUpb_EnumValueDescriptor_Getters},
850  {0, NULL}};
851 
852 static PyType_Spec PyUpb_EnumValueDescriptor_Spec = {
853  PYUPB_MODULE_NAME ".EnumValueDescriptor", // tp_name
854  sizeof(PyUpb_DescriptorBase), // tp_basicsize
855  0, // tp_itemsize
856  Py_TPFLAGS_DEFAULT, // tp_flags
858 };
859 
860 // -----------------------------------------------------------------------------
861 // FieldDescriptor
862 // -----------------------------------------------------------------------------
863 
865  PyUpb_DescriptorBase* self =
867  return self ? self->def : NULL;
868 }
869 
873 }
874 
876  void* closure) {
877  return PyUnicode_FromString(upb_FieldDef_FullName(self->def));
878 }
879 
881  void* closure) {
882  return PyUnicode_FromString(upb_FieldDef_Name(self->def));
883 }
884 
886  PyUpb_DescriptorBase* self, void* closure) {
887  // TODO: Ok to use jsonname here?
888  return PyUnicode_FromString(upb_FieldDef_JsonName(self->def));
889 }
890 
892  void* closure) {
893  return PyUnicode_FromString(upb_FieldDef_JsonName(self->def));
894 }
895 
897  void* closure) {
898  const upb_FileDef* file = upb_FieldDef_File(self->def);
899  if (!file) Py_RETURN_NONE;
901 }
902 
904  void* closure) {
905  return PyLong_FromLong(upb_FieldDef_Type(self->def));
906 }
907 
909  void* closure) {
910  // Enum values copied from descriptor.h in C++.
911  enum CppType {
912  CPPTYPE_INT32 = 1, // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32
913  CPPTYPE_INT64 = 2, // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64
914  CPPTYPE_UINT32 = 3, // TYPE_UINT32, TYPE_FIXED32
915  CPPTYPE_UINT64 = 4, // TYPE_UINT64, TYPE_FIXED64
916  CPPTYPE_DOUBLE = 5, // TYPE_DOUBLE
917  CPPTYPE_FLOAT = 6, // TYPE_FLOAT
918  CPPTYPE_BOOL = 7, // TYPE_BOOL
919  CPPTYPE_ENUM = 8, // TYPE_ENUM
920  CPPTYPE_STRING = 9, // TYPE_STRING, TYPE_BYTES
921  CPPTYPE_MESSAGE = 10, // TYPE_MESSAGE, TYPE_GROUP
922  };
923  static const uint8_t cpp_types[] = {
924  -1,
925  [kUpb_CType_Int32] = CPPTYPE_INT32,
926  [kUpb_CType_Int64] = CPPTYPE_INT64,
927  [kUpb_CType_UInt32] = CPPTYPE_UINT32,
928  [kUpb_CType_UInt64] = CPPTYPE_UINT64,
929  [kUpb_CType_Double] = CPPTYPE_DOUBLE,
930  [kUpb_CType_Float] = CPPTYPE_FLOAT,
931  [kUpb_CType_Bool] = CPPTYPE_BOOL,
932  [kUpb_CType_Enum] = CPPTYPE_ENUM,
933  [kUpb_CType_String] = CPPTYPE_STRING,
934  [kUpb_CType_Bytes] = CPPTYPE_STRING,
935  [kUpb_CType_Message] = CPPTYPE_MESSAGE,
936  };
937  return PyLong_FromLong(cpp_types[upb_FieldDef_CType(self->def)]);
938 }
939 
941  void* closure) {
942  return PyLong_FromLong(upb_FieldDef_Label(self->def));
943 }
944 
946  PyUpb_DescriptorBase* self, void* closure) {
947  return PyBool_FromLong(upb_FieldDef_IsExtension(self->def));
948 }
949 
951  void* closure) {
952  return PyLong_FromLong(upb_FieldDef_Number(self->def));
953 }
954 
956  void* closure) {
957  return PyLong_FromLong(upb_FieldDef_Index(self->def));
958 }
959 
961  PyUpb_DescriptorBase* self, void* closure) {
962  const upb_MessageDef* subdef = upb_FieldDef_MessageSubDef(self->def);
963  if (!subdef) Py_RETURN_NONE;
964  return PyUpb_Descriptor_Get(subdef);
965 }
966 
968  void* closure) {
970  if (!enumdef) Py_RETURN_NONE;
972 }
973 
975  PyUpb_DescriptorBase* self, void* closure) {
977  if (!m) Py_RETURN_NONE;
978  return PyUpb_Descriptor_Get(m);
979 }
980 
982  PyUpb_DescriptorBase* self, void* closure) {
984  if (!m) Py_RETURN_NONE;
985  return PyUpb_Descriptor_Get(m);
986 }
987 
989  PyUpb_DescriptorBase* self, void* closure) {
990  return PyBool_FromLong(upb_FieldDef_HasDefault(self->def));
991 }
992 
994  PyUpb_DescriptorBase* self, void* closure) {
995  const upb_FieldDef* f = self->def;
996  if (upb_FieldDef_IsRepeated(f)) return PyList_New(0);
997  if (upb_FieldDef_IsSubMessage(f)) Py_RETURN_NONE;
998  return PyUpb_UpbToPy(upb_FieldDef_Default(self->def), self->def, NULL);
999 }
1000 
1002  PyUpb_DescriptorBase* self, void* closure) {
1003  const upb_OneofDef* oneof = upb_FieldDef_ContainingOneof(self->def);
1004  if (!oneof) Py_RETURN_NONE;
1005  return PyUpb_OneofDescriptor_Get(oneof);
1006 }
1007 
1009  PyUpb_DescriptorBase* _self, void* closure) {
1010  PyUpb_DescriptorBase* self = (void*)_self;
1011  return PyBool_FromLong(upb_FieldDef_HasOptions(self->def));
1012 }
1013 
1014 static PyObject* PyUpb_FieldDescriptor_GetOptions(PyObject* _self,
1015  PyObject* args) {
1016  PyUpb_DescriptorBase* self = (void*)_self;
1020  ".FieldOptions");
1021 }
1022 
1023 static PyGetSetDef PyUpb_FieldDescriptor_Getters[] = {
1024  {"full_name", (getter)PyUpb_FieldDescriptor_GetFullName, NULL, "Full name"},
1025  {"name", (getter)PyUpb_FieldDescriptor_GetName, NULL, "Unqualified name"},
1026  {"camelcase_name", (getter)PyUpb_FieldDescriptor_GetCamelCaseName, NULL,
1027  "CamelCase name"},
1028  {"json_name", (getter)PyUpb_FieldDescriptor_GetJsonName, NULL, "Json name"},
1029  {"file", (getter)PyUpb_FieldDescriptor_GetFile, NULL, "File Descriptor"},
1030  {"type", (getter)PyUpb_FieldDescriptor_GetType, NULL, "Type"},
1031  {"cpp_type", (getter)PyUpb_FieldDescriptor_GetCppType, NULL, "C++ Type"},
1032  {"label", (getter)PyUpb_FieldDescriptor_GetLabel, NULL, "Label"},
1033  {"number", (getter)PyUpb_FieldDescriptor_GetNumber, NULL, "Number"},
1034  {"index", (getter)PyUpb_FieldDescriptor_GetIndex, NULL, "Index"},
1035  {"default_value", (getter)PyUpb_FieldDescriptor_GetDefaultValue, NULL,
1036  "Default Value"},
1037  {"has_default_value", (getter)PyUpb_FieldDescriptor_HasDefaultValue},
1038  {"is_extension", (getter)PyUpb_FieldDescriptor_GetIsExtension, NULL, "ID"},
1039  // TODO(https://github.com/protocolbuffers/upb/issues/459)
1040  //{ "id", (getter)GetID, NULL, "ID"},
1041  {"message_type", (getter)PyUpb_FieldDescriptor_GetMessageType, NULL,
1042  "Message type"},
1043  {"enum_type", (getter)PyUpb_FieldDescriptor_GetEnumType, NULL, "Enum type"},
1044  {"containing_type", (getter)PyUpb_FieldDescriptor_GetContainingType, NULL,
1045  "Containing type"},
1046  {"extension_scope", (getter)PyUpb_FieldDescriptor_GetExtensionScope, NULL,
1047  "Extension scope"},
1048  {"containing_oneof", (getter)PyUpb_FieldDescriptor_GetContainingOneof, NULL,
1049  "Containing oneof"},
1050  {"has_options", (getter)PyUpb_FieldDescriptor_GetHasOptions, NULL,
1051  "Has Options"},
1052  // TODO(https://github.com/protocolbuffers/upb/issues/459)
1053  //{ "_options",
1054  //(getter)NULL, (setter)SetOptions, "Options"}, { "_serialized_options",
1055  //(getter)NULL, (setter)SetSerializedOptions, "Serialized Options"},
1056  {NULL}};
1057 
1058 static PyMethodDef PyUpb_FieldDescriptor_Methods[] = {
1059  {
1060  "GetOptions",
1062  METH_NOARGS,
1063  },
1064  {NULL}};
1065 
1066 static PyType_Slot PyUpb_FieldDescriptor_Slots[] = {
1068  {Py_tp_methods, PyUpb_FieldDescriptor_Methods},
1069  {Py_tp_getset, PyUpb_FieldDescriptor_Getters},
1070  {0, NULL}};
1071 
1072 static PyType_Spec PyUpb_FieldDescriptor_Spec = {
1073  PYUPB_MODULE_NAME ".FieldDescriptor",
1074  sizeof(PyUpb_DescriptorBase),
1075  0, // tp_itemsize
1076  Py_TPFLAGS_DEFAULT,
1078 };
1079 
1080 // -----------------------------------------------------------------------------
1081 // FileDescriptor
1082 // -----------------------------------------------------------------------------
1083 
1086 }
1087 
1088 // These are not provided on upb_FileDef because they use the underlying
1089 // symtab's hash table. This works for Python because everything happens under
1090 // the GIL, but in general the caller has to guarantee that the symtab is not
1091 // being mutated concurrently.
1092 typedef const void* PyUpb_FileDescriptor_LookupFunc(const upb_DefPool*,
1093  const char*);
1094 
1096  const upb_FileDef* filedef, const char* name,
1098  const upb_DefPool* symtab = upb_FileDef_Pool(filedef);
1099  const char* package = upb_FileDef_Package(filedef);
1100  if (package) {
1101  PyObject* qname = PyUnicode_FromFormat("%s.%s", package, name);
1102  const void* ret = func(symtab, PyUnicode_AsUTF8AndSize(qname, NULL));
1103  Py_DECREF(qname);
1104  return ret;
1105  } else {
1106  return func(symtab, name);
1107  }
1108 }
1109 
1111  const upb_FileDef* filedef, const char* name) {
1113  filedef, name, (void*)&upb_DefPool_FindMessageByName);
1114 }
1115 
1116 static const void* PyUpb_FileDescriptor_LookupEnum(const upb_FileDef* filedef,
1117  const char* name) {
1118  return PyUpb_FileDescriptor_NestedLookup(filedef, name,
1119  (void*)&upb_DefPool_FindEnumByName);
1120 }
1121 
1123  const upb_FileDef* filedef, const char* name) {
1125  filedef, name, (void*)&upb_DefPool_FindExtensionByName);
1126 }
1127 
1129  const upb_FileDef* filedef, const char* name) {
1131  filedef, name, (void*)&upb_DefPool_FindServiceByName);
1132 }
1133 
1135  void* closure) {
1136  return PyUnicode_FromString(upb_FileDef_Name(self->def));
1137 }
1138 
1139 static PyObject* PyUpb_FileDescriptor_GetPool(PyObject* _self, void* closure) {
1141  Py_INCREF(self->pool);
1142  return self->pool;
1143 }
1144 
1145 static PyObject* PyUpb_FileDescriptor_GetPackage(PyObject* _self,
1146  void* closure) {
1148  return PyUnicode_FromString(upb_FileDef_Package(self->def));
1149 }
1150 
1151 static PyObject* PyUpb_FileDescriptor_GetSerializedPb(PyObject* self,
1152  void* closure) {
1156 }
1157 
1158 static PyObject* PyUpb_FileDescriptor_GetMessageTypesByName(PyObject* _self,
1159  void* closure) {
1160  static PyUpb_ByNameMap_Funcs funcs = {
1161  {
1164  (void*)&PyUpb_Descriptor_Get,
1165  },
1167  (void*)&upb_MessageDef_Name,
1168  };
1169  PyUpb_DescriptorBase* self = (void*)_self;
1170  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
1171 }
1172 
1173 static PyObject* PyUpb_FileDescriptor_GetEnumTypesByName(PyObject* _self,
1174  void* closure) {
1175  static PyUpb_ByNameMap_Funcs funcs = {
1176  {
1178  (void*)&upb_FileDef_TopLevelEnum,
1179  (void*)&PyUpb_EnumDescriptor_Get,
1180  },
1182  (void*)&upb_EnumDef_Name,
1183  };
1184  PyUpb_DescriptorBase* self = (void*)_self;
1185  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
1186 }
1187 
1188 static PyObject* PyUpb_FileDescriptor_GetExtensionsByName(PyObject* _self,
1189  void* closure) {
1190  static PyUpb_ByNameMap_Funcs funcs = {
1191  {
1194  (void*)&PyUpb_FieldDescriptor_Get,
1195  },
1197  (void*)&upb_FieldDef_Name,
1198  };
1199  PyUpb_DescriptorBase* self = (void*)_self;
1200  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
1201 }
1202 
1203 static PyObject* PyUpb_FileDescriptor_GetServicesByName(PyObject* _self,
1204  void* closure) {
1205  static PyUpb_ByNameMap_Funcs funcs = {
1206  {
1207  (void*)&upb_FileDef_ServiceCount,
1208  (void*)&upb_FileDef_Service,
1210  },
1212  (void*)&upb_ServiceDef_Name,
1213  };
1214  PyUpb_DescriptorBase* self = (void*)_self;
1215  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
1216 }
1217 
1218 static PyObject* PyUpb_FileDescriptor_GetDependencies(PyObject* _self,
1219  void* closure) {
1220  PyUpb_DescriptorBase* self = (void*)_self;
1221  static PyUpb_GenericSequence_Funcs funcs = {
1223  (void*)&upb_FileDef_Dependency,
1224  (void*)&PyUpb_FileDescriptor_Get,
1225  };
1226  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
1227 }
1228 
1229 static PyObject* PyUpb_FileDescriptor_GetPublicDependencies(PyObject* _self,
1230  void* closure) {
1231  PyUpb_DescriptorBase* self = (void*)_self;
1232  static PyUpb_GenericSequence_Funcs funcs = {
1235  (void*)&PyUpb_FileDescriptor_Get,
1236  };
1237  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
1238 }
1239 
1240 static PyObject* PyUpb_FileDescriptor_GetSyntax(PyObject* _self,
1241  void* closure) {
1242  PyUpb_DescriptorBase* self = (void*)_self;
1243  const char* syntax =
1244  upb_FileDef_Syntax(self->def) == kUpb_Syntax_Proto2 ? "proto2" : "proto3";
1245  return PyUnicode_FromString(syntax);
1246 }
1247 
1248 static PyObject* PyUpb_FileDescriptor_GetHasOptions(PyObject* _self,
1249  void* closure) {
1250  PyUpb_DescriptorBase* self = (void*)_self;
1251  return PyBool_FromLong(upb_FileDef_HasOptions(self->def));
1252 }
1253 
1254 static PyObject* PyUpb_FileDescriptor_GetOptions(PyObject* _self,
1255  PyObject* args) {
1256  PyUpb_DescriptorBase* self = (void*)_self;
1260  ".FileOptions");
1261 }
1262 
1263 static PyObject* PyUpb_FileDescriptor_CopyToProto(PyObject* _self,
1264  PyObject* py_proto) {
1268  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".FileDescriptorProto", py_proto);
1269 }
1270 
1271 static PyGetSetDef PyUpb_FileDescriptor_Getters[] = {
1272  {"pool", PyUpb_FileDescriptor_GetPool, NULL, "pool"},
1273  {"name", (getter)PyUpb_FileDescriptor_GetName, NULL, "name"},
1274  {"package", PyUpb_FileDescriptor_GetPackage, NULL, "package"},
1275  {"serialized_pb", PyUpb_FileDescriptor_GetSerializedPb},
1276  {"message_types_by_name", PyUpb_FileDescriptor_GetMessageTypesByName, NULL,
1277  "Messages by name"},
1278  {"enum_types_by_name", PyUpb_FileDescriptor_GetEnumTypesByName, NULL,
1279  "Enums by name"},
1280  {"extensions_by_name", PyUpb_FileDescriptor_GetExtensionsByName, NULL,
1281  "Extensions by name"},
1282  {"services_by_name", PyUpb_FileDescriptor_GetServicesByName, NULL,
1283  "Services by name"},
1284  {"dependencies", PyUpb_FileDescriptor_GetDependencies, NULL,
1285  "Dependencies"},
1286  {"public_dependencies", PyUpb_FileDescriptor_GetPublicDependencies, NULL,
1287  "Dependencies"},
1288  {"has_options", PyUpb_FileDescriptor_GetHasOptions, NULL, "Has Options"},
1289  {"syntax", PyUpb_FileDescriptor_GetSyntax, (setter)NULL, "Syntax"},
1290  {NULL},
1291 };
1292 
1293 static PyMethodDef PyUpb_FileDescriptor_Methods[] = {
1294  {"GetOptions", PyUpb_FileDescriptor_GetOptions, METH_NOARGS},
1295  {"CopyToProto", PyUpb_FileDescriptor_CopyToProto, METH_O},
1296  {NULL}};
1297 
1298 static PyType_Slot PyUpb_FileDescriptor_Slots[] = {
1300  {Py_tp_methods, PyUpb_FileDescriptor_Methods},
1301  {Py_tp_getset, PyUpb_FileDescriptor_Getters},
1302  {0, NULL}};
1303 
1304 static PyType_Spec PyUpb_FileDescriptor_Spec = {
1305  PYUPB_MODULE_NAME ".FileDescriptor", // tp_name
1306  sizeof(PyUpb_DescriptorBase), // tp_basicsize
1307  0, // tp_itemsize
1308  Py_TPFLAGS_DEFAULT, // tp_flags
1310 };
1311 
1312 const upb_FileDef* PyUpb_FileDescriptor_GetDef(PyObject* _self) {
1313  PyUpb_DescriptorBase* self =
1315  return self ? self->def : NULL;
1316 }
1317 
1318 // -----------------------------------------------------------------------------
1319 // MethodDescriptor
1320 // -----------------------------------------------------------------------------
1321 
1323  PyUpb_DescriptorBase* self =
1325  return self ? self->def : NULL;
1326 }
1327 
1331 }
1332 
1333 static PyObject* PyUpb_MethodDescriptor_GetName(PyObject* self, void* closure) {
1335  return PyUnicode_FromString(upb_MethodDef_Name(m));
1336 }
1337 
1338 static PyObject* PyUpb_MethodDescriptor_GetFullName(PyObject* self,
1339  void* closure) {
1341  return PyUnicode_FromString(upb_MethodDef_FullName(m));
1342 }
1343 
1344 static PyObject* PyUpb_MethodDescriptor_GetIndex(PyObject* self,
1345  void* closure) {
1346  const upb_MethodDef* oneof = PyUpb_MethodDescriptor_GetDef(self);
1347  return PyLong_FromLong(upb_MethodDef_Index(oneof));
1348 }
1349 
1350 static PyObject* PyUpb_MethodDescriptor_GetContainingService(PyObject* self,
1351  void* closure) {
1354 }
1355 
1356 static PyObject* PyUpb_MethodDescriptor_GetInputType(PyObject* self,
1357  void* closure) {
1360 }
1361 
1362 static PyObject* PyUpb_MethodDescriptor_GetOutputType(PyObject* self,
1363  void* closure) {
1366 }
1367 
1368 static PyObject* PyUpb_MethodDescriptor_GetOptions(PyObject* _self,
1369  PyObject* args) {
1370  PyUpb_DescriptorBase* self = (void*)_self;
1374  ".MethodOptions");
1375 }
1376 
1377 static PyObject* PyUpb_MethodDescriptor_CopyToProto(PyObject* _self,
1378  PyObject* py_proto) {
1382  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".MethodDescriptorProto", py_proto);
1383 }
1384 
1385 static PyGetSetDef PyUpb_MethodDescriptor_Getters[] = {
1386  {"name", PyUpb_MethodDescriptor_GetName, NULL, "Name", NULL},
1387  {"full_name", PyUpb_MethodDescriptor_GetFullName, NULL, "Full name", NULL},
1388  {"index", PyUpb_MethodDescriptor_GetIndex, NULL, "Index", NULL},
1389  {"containing_service", PyUpb_MethodDescriptor_GetContainingService, NULL,
1390  "Containing service", NULL},
1391  {"input_type", PyUpb_MethodDescriptor_GetInputType, NULL, "Input type",
1392  NULL},
1393  {"output_type", PyUpb_MethodDescriptor_GetOutputType, NULL, "Output type",
1394  NULL},
1395  {NULL}};
1396 
1397 static PyMethodDef PyUpb_MethodDescriptor_Methods[] = {
1398  {"GetOptions", PyUpb_MethodDescriptor_GetOptions, METH_NOARGS},
1399  {"CopyToProto", PyUpb_MethodDescriptor_CopyToProto, METH_O},
1400  {NULL}};
1401 
1402 static PyType_Slot PyUpb_MethodDescriptor_Slots[] = {
1404  {Py_tp_methods, PyUpb_MethodDescriptor_Methods},
1405  {Py_tp_getset, PyUpb_MethodDescriptor_Getters},
1406  {0, NULL}};
1407 
1408 static PyType_Spec PyUpb_MethodDescriptor_Spec = {
1409  PYUPB_MODULE_NAME ".MethodDescriptor", // tp_name
1410  sizeof(PyUpb_DescriptorBase), // tp_basicsize
1411  0, // tp_itemsize
1412  Py_TPFLAGS_DEFAULT, // tp_flags
1414 };
1415 
1416 // -----------------------------------------------------------------------------
1417 // OneofDescriptor
1418 // -----------------------------------------------------------------------------
1419 
1421  PyUpb_DescriptorBase* self =
1423  return self ? self->def : NULL;
1424 }
1425 
1426 PyObject* PyUpb_OneofDescriptor_Get(const upb_OneofDef* oneof) {
1427  const upb_FileDef* file =
1430 }
1431 
1432 static PyObject* PyUpb_OneofDescriptor_GetName(PyObject* self, void* closure) {
1433  const upb_OneofDef* oneof = PyUpb_OneofDescriptor_GetDef(self);
1434  return PyUnicode_FromString(upb_OneofDef_Name(oneof));
1435 }
1436 
1437 static PyObject* PyUpb_OneofDescriptor_GetFullName(PyObject* self,
1438  void* closure) {
1439  const upb_OneofDef* oneof = PyUpb_OneofDescriptor_GetDef(self);
1440  return PyUnicode_FromFormat(
1442  upb_OneofDef_Name(oneof));
1443 }
1444 
1445 static PyObject* PyUpb_OneofDescriptor_GetIndex(PyObject* self, void* closure) {
1446  const upb_OneofDef* oneof = PyUpb_OneofDescriptor_GetDef(self);
1447  return PyLong_FromLong(upb_OneofDef_Index(oneof));
1448 }
1449 
1450 static PyObject* PyUpb_OneofDescriptor_GetContainingType(PyObject* self,
1451  void* closure) {
1452  const upb_OneofDef* oneof = PyUpb_OneofDescriptor_GetDef(self);
1454 }
1455 
1456 static PyObject* PyUpb_OneofDescriptor_GetHasOptions(PyObject* _self,
1457  void* closure) {
1458  PyUpb_DescriptorBase* self = (void*)_self;
1459  return PyBool_FromLong(upb_OneofDef_HasOptions(self->def));
1460 }
1461 
1462 static PyObject* PyUpb_OneofDescriptor_GetFields(PyObject* _self,
1463  void* closure) {
1464  PyUpb_DescriptorBase* self = (void*)_self;
1465  static PyUpb_GenericSequence_Funcs funcs = {
1466  (void*)&upb_OneofDef_FieldCount,
1467  (void*)&upb_OneofDef_Field,
1468  (void*)&PyUpb_FieldDescriptor_Get,
1469  };
1470  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
1471 }
1472 
1473 static PyObject* PyUpb_OneofDescriptor_GetOptions(PyObject* _self,
1474  PyObject* args) {
1475  PyUpb_DescriptorBase* self = (void*)_self;
1479  ".OneofOptions");
1480 }
1481 
1482 static PyGetSetDef PyUpb_OneofDescriptor_Getters[] = {
1483  {"name", PyUpb_OneofDescriptor_GetName, NULL, "Name"},
1484  {"full_name", PyUpb_OneofDescriptor_GetFullName, NULL, "Full name"},
1485  {"index", PyUpb_OneofDescriptor_GetIndex, NULL, "Index"},
1486  {"containing_type", PyUpb_OneofDescriptor_GetContainingType, NULL,
1487  "Containing type"},
1488  {"has_options", PyUpb_OneofDescriptor_GetHasOptions, NULL, "Has Options"},
1489  {"fields", PyUpb_OneofDescriptor_GetFields, NULL, "Fields"},
1490  {NULL}};
1491 
1492 static PyMethodDef PyUpb_OneofDescriptor_Methods[] = {
1493  {"GetOptions", PyUpb_OneofDescriptor_GetOptions, METH_NOARGS}, {NULL}};
1494 
1495 static PyType_Slot PyUpb_OneofDescriptor_Slots[] = {
1497  {Py_tp_methods, PyUpb_OneofDescriptor_Methods},
1498  {Py_tp_getset, PyUpb_OneofDescriptor_Getters},
1499  {0, NULL}};
1500 
1501 static PyType_Spec PyUpb_OneofDescriptor_Spec = {
1502  PYUPB_MODULE_NAME ".OneofDescriptor", // tp_name
1503  sizeof(PyUpb_DescriptorBase), // tp_basicsize
1504  0, // tp_itemsize
1505  Py_TPFLAGS_DEFAULT, // tp_flags
1507 };
1508 
1509 // -----------------------------------------------------------------------------
1510 // ServiceDescriptor
1511 // -----------------------------------------------------------------------------
1512 
1514  PyUpb_DescriptorBase* self =
1516  return self ? self->def : NULL;
1517 }
1518 
1520  const upb_FileDef* file = upb_ServiceDef_File(s);
1522 }
1523 
1524 static PyObject* PyUpb_ServiceDescriptor_GetFullName(PyObject* self,
1525  void* closure) {
1527  return PyUnicode_FromString(upb_ServiceDef_FullName(s));
1528 }
1529 
1530 static PyObject* PyUpb_ServiceDescriptor_GetName(PyObject* self,
1531  void* closure) {
1533  return PyUnicode_FromString(upb_ServiceDef_Name(s));
1534 }
1535 
1536 static PyObject* PyUpb_ServiceDescriptor_GetFile(PyObject* self,
1537  void* closure) {
1540 }
1541 
1542 static PyObject* PyUpb_ServiceDescriptor_GetIndex(PyObject* self,
1543  void* closure) {
1545  return PyLong_FromLong(upb_ServiceDef_Index(s));
1546 }
1547 
1548 static PyObject* PyUpb_ServiceDescriptor_GetMethods(PyObject* _self,
1549  void* closure) {
1550  PyUpb_DescriptorBase* self = (void*)_self;
1551  static PyUpb_GenericSequence_Funcs funcs = {
1553  (void*)&upb_ServiceDef_Method,
1555  };
1556  return PyUpb_GenericSequence_New(&funcs, self->def, self->pool);
1557 }
1558 
1559 static PyObject* PyUpb_ServiceDescriptor_GetMethodsByName(PyObject* _self,
1560  void* closure) {
1561  static PyUpb_ByNameMap_Funcs funcs = {
1562  {
1564  (void*)&upb_ServiceDef_Method,
1566  },
1568  (void*)&upb_MethodDef_Name,
1569  };
1570  PyUpb_DescriptorBase* self = (void*)_self;
1571  return PyUpb_ByNameMap_New(&funcs, self->def, self->pool);
1572 }
1573 
1574 static PyObject* PyUpb_ServiceDescriptor_GetOptions(PyObject* _self,
1575  PyObject* args) {
1576  PyUpb_DescriptorBase* self = (void*)_self;
1578  self, upb_ServiceDef_Options(self->def),
1580  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".ServiceOptions");
1581 }
1582 
1583 static PyObject* PyUpb_ServiceDescriptor_CopyToProto(PyObject* _self,
1584  PyObject* py_proto) {
1588  PYUPB_DESCRIPTOR_PROTO_PACKAGE ".ServiceDescriptorProto", py_proto);
1589 }
1590 
1591 static PyObject* PyUpb_ServiceDescriptor_FindMethodByName(PyObject* _self,
1592  PyObject* py_name) {
1593  PyUpb_DescriptorBase* self = (void*)_self;
1594  const char* name = PyUnicode_AsUTF8AndSize(py_name, NULL);
1595  if (!name) return NULL;
1596  const upb_MethodDef* method =
1598  if (method == NULL) {
1599  return PyErr_Format(PyExc_KeyError, "Couldn't find method %.200s", name);
1600  }
1602 }
1603 
1604 static PyGetSetDef PyUpb_ServiceDescriptor_Getters[] = {
1605  {"name", PyUpb_ServiceDescriptor_GetName, NULL, "Name", NULL},
1606  {"full_name", PyUpb_ServiceDescriptor_GetFullName, NULL, "Full name", NULL},
1607  {"file", PyUpb_ServiceDescriptor_GetFile, NULL, "File descriptor"},
1608  {"index", PyUpb_ServiceDescriptor_GetIndex, NULL, "Index", NULL},
1609  {"methods", PyUpb_ServiceDescriptor_GetMethods, NULL, "Methods", NULL},
1610  {"methods_by_name", PyUpb_ServiceDescriptor_GetMethodsByName, NULL,
1611  "Methods by name", NULL},
1612  {NULL}};
1613 
1614 static PyMethodDef PyUpb_ServiceDescriptor_Methods[] = {
1615  {"GetOptions", PyUpb_ServiceDescriptor_GetOptions, METH_NOARGS},
1616  {"CopyToProto", PyUpb_ServiceDescriptor_CopyToProto, METH_O},
1617  {"FindMethodByName", PyUpb_ServiceDescriptor_FindMethodByName, METH_O},
1618  {NULL}};
1619 
1620 static PyType_Slot PyUpb_ServiceDescriptor_Slots[] = {
1622  {Py_tp_methods, PyUpb_ServiceDescriptor_Methods},
1623  {Py_tp_getset, PyUpb_ServiceDescriptor_Getters},
1624  {0, NULL}};
1625 
1626 static PyType_Spec PyUpb_ServiceDescriptor_Spec = {
1627  PYUPB_MODULE_NAME ".ServiceDescriptor", // tp_name
1628  sizeof(PyUpb_DescriptorBase), // tp_basicsize
1629  0, // tp_itemsize
1630  Py_TPFLAGS_DEFAULT, // tp_flags
1632 };
1633 
1634 // -----------------------------------------------------------------------------
1635 // Top Level
1636 // -----------------------------------------------------------------------------
1637 
1638 static bool PyUpb_SetIntAttr(PyObject* obj, const char* name, int val) {
1639  PyObject* num = PyLong_FromLong(val);
1640  if (!num) return false;
1641  int status = PyObject_SetAttrString(obj, name, num);
1642  Py_DECREF(num);
1643  return status >= 0;
1644 }
1645 
1646 // These must be in the same order as PyUpb_DescriptorType in the header.
1647 static PyType_Spec* desc_specs[] = {
1652 };
1653 
1654 bool PyUpb_InitDescriptor(PyObject* m) {
1656 
1657  for (size_t i = 0; i < kPyUpb_Descriptor_Count; i++) {
1658  s->descriptor_types[i] = PyUpb_AddClass(m, desc_specs[i]);
1659  if (!s->descriptor_types[i]) {
1660  return false;
1661  }
1662  }
1663 
1664  PyObject* fd = (PyObject*)s->descriptor_types[kPyUpb_FieldDescriptor];
1665  return PyUpb_SetIntAttr(fd, "LABEL_OPTIONAL", kUpb_Label_Optional) &&
1666  PyUpb_SetIntAttr(fd, "LABEL_REPEATED", kUpb_Label_Repeated) &&
1667  PyUpb_SetIntAttr(fd, "LABEL_REQUIRED", kUpb_Label_Required) &&
1668  PyUpb_SetIntAttr(fd, "TYPE_BOOL", kUpb_FieldType_Bool) &&
1669  PyUpb_SetIntAttr(fd, "TYPE_BYTES", kUpb_FieldType_Bytes) &&
1670  PyUpb_SetIntAttr(fd, "TYPE_DOUBLE", kUpb_FieldType_Double) &&
1671  PyUpb_SetIntAttr(fd, "TYPE_ENUM", kUpb_FieldType_Enum) &&
1672  PyUpb_SetIntAttr(fd, "TYPE_FIXED32", kUpb_FieldType_Fixed32) &&
1673  PyUpb_SetIntAttr(fd, "TYPE_FIXED64", kUpb_FieldType_Fixed64) &&
1674  PyUpb_SetIntAttr(fd, "TYPE_FLOAT", kUpb_FieldType_Float) &&
1675  PyUpb_SetIntAttr(fd, "TYPE_GROUP", kUpb_FieldType_Group) &&
1676  PyUpb_SetIntAttr(fd, "TYPE_INT32", kUpb_FieldType_Int32) &&
1677  PyUpb_SetIntAttr(fd, "TYPE_INT64", kUpb_FieldType_Int64) &&
1678  PyUpb_SetIntAttr(fd, "TYPE_MESSAGE", kUpb_FieldType_Message) &&
1679  PyUpb_SetIntAttr(fd, "TYPE_SFIXED32", kUpb_FieldType_SFixed32) &&
1680  PyUpb_SetIntAttr(fd, "TYPE_SFIXED64", kUpb_FieldType_SFixed64) &&
1681  PyUpb_SetIntAttr(fd, "TYPE_SINT32", kUpb_FieldType_SInt32) &&
1682  PyUpb_SetIntAttr(fd, "TYPE_SINT64", kUpb_FieldType_SInt64) &&
1683  PyUpb_SetIntAttr(fd, "TYPE_STRING", kUpb_FieldType_String) &&
1684  PyUpb_SetIntAttr(fd, "TYPE_UINT32", kUpb_FieldType_UInt32) &&
1685  PyUpb_SetIntAttr(fd, "TYPE_UINT64", kUpb_FieldType_UInt64);
1686 }
PyUpb_Descriptor_EnumValueName
static PyObject * PyUpb_Descriptor_EnumValueName(PyObject *_self, PyObject *args)
Definition: descriptor.c:337
PyUpb_Descriptor_GetOptions
static PyObject * PyUpb_Descriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:321
PyUpb_FieldDescriptor_GetEnumType
static PyObject * PyUpb_FieldDescriptor_GetEnumType(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:967
upb_EnumDef_ContainingType
const upb_MessageDef * upb_EnumDef_ContainingType(const upb_EnumDef *e)
Definition: upb/upb/def.c:398
PyUpb_Descriptor_GetExtensionRanges
static PyObject * PyUpb_Descriptor_GetExtensionRanges(PyObject *_self, void *closure)
Definition: descriptor.c:258
upb_OneofDef_Name
const char * upb_OneofDef_Name(const upb_OneofDef *o)
Definition: upb/upb/def.c:870
xds_interop_client.str
str
Definition: xds_interop_client.py:487
upb_MethodDef_ToProto
google_protobuf_MethodDescriptorProto * upb_MethodDef_ToProto(const upb_MethodDef *m, upb_Arena *a)
Definition: def_to_proto.c:546
PyUpb_FileDescriptor_GetSyntax
static PyObject * PyUpb_FileDescriptor_GetSyntax(PyObject *_self, void *closure)
Definition: descriptor.c:1240
PyUpb_FieldDescriptor_GetIsExtension
static PyObject * PyUpb_FieldDescriptor_GetIsExtension(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:945
PyUpb_DescriptorBase::options
PyObject * options
Definition: descriptor.c:48
PyUpb_Descriptor_LookupNestedEnum
static const void * PyUpb_Descriptor_LookupNestedEnum(const upb_MessageDef *m, const char *name)
Definition: descriptor.c:234
upb_FieldDef_Type
upb_FieldType upb_FieldDef_Type(const upb_FieldDef *f)
Definition: upb/upb/def.c:535
PyUpb_Descriptor_GetSyntax
static PyObject * PyUpb_Descriptor_GetSyntax(PyObject *self, void *closure)
Definition: descriptor.c:575
convert.h
upb_FieldDef_Number
uint32_t upb_FieldDef_Number(const upb_FieldDef *f)
Definition: upb/upb/def.c:541
upb_FieldDef_HasDefault
bool upb_FieldDef_HasDefault(const upb_FieldDef *f)
Definition: upb/upb/def.c:664
PyUpb_FileDescriptor_GetHasOptions
static PyObject * PyUpb_FileDescriptor_GetHasOptions(PyObject *_self, void *closure)
Definition: descriptor.c:1248
PyUpb_ServiceDescriptor_Get
PyObject * PyUpb_ServiceDescriptor_Get(const upb_ServiceDef *s)
Definition: descriptor.c:1519
obj
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1671
kUpb_CType_String
@ kUpb_CType_String
Definition: upb/upb/upb.h:296
kUpb_FieldType_SInt64
@ kUpb_FieldType_SInt64
Definition: upb/upb/upb.h:326
kUpb_CType_UInt32
@ kUpb_CType_UInt32
Definition: upb/upb/upb.h:290
kUpb_FieldType_SFixed64
@ kUpb_FieldType_SFixed64
Definition: upb/upb/upb.h:324
google_protobuf_EnumOptions_msginit
const upb_MiniTable google_protobuf_EnumOptions_msginit
Definition: descriptor.upb.c:353
PyUpb_MethodDescriptor_Get
PyObject * PyUpb_MethodDescriptor_Get(const upb_MethodDef *m)
Definition: descriptor.c:1328
kUpb_CType_Int32
@ kUpb_CType_Int32
Definition: upb/upb/upb.h:289
upb_DefPool_FindEnumByName
const upb_EnumDef * upb_DefPool_FindEnumByName(const upb_DefPool *s, const char *sym)
Definition: upb/upb/def.c:1135
kUpb_FieldType_SInt32
@ kUpb_FieldType_SInt32
Definition: upb/upb/upb.h:325
PyUpb_DescriptorBase_Get
static PyObject * PyUpb_DescriptorBase_Get(PyUpb_DescriptorType type, const void *def, const upb_FileDef *file)
Definition: descriptor.c:79
PyUpb_FileDescriptor_GetServicesByName
static PyObject * PyUpb_FileDescriptor_GetServicesByName(PyObject *_self, void *closure)
Definition: descriptor.c:1203
PyUpb_DescriptorPool_GetDefaultPool
PyObject * PyUpb_DescriptorPool_GetDefaultPool()
Definition: descriptor_pool.c:48
upb_MessageDef_ExtensionRange
const upb_ExtensionRange * upb_MessageDef_ExtensionRange(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:822
PyUpb_ServiceDescriptor_Slots
static PyType_Slot PyUpb_ServiceDescriptor_Slots[]
Definition: descriptor.c:1620
PyUpb_ToProto_Func
void * PyUpb_ToProto_Func(const void *def, upb_Arena *arena)
Definition: descriptor.c:143
PyUpb_FieldDescriptor_GetContainingOneof
static PyObject * PyUpb_FieldDescriptor_GetContainingOneof(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:1001
upb_FileDef_Package
const char * upb_FileDef_Package(const upb_FileDef *f)
Definition: upb/upb/def.c:922
PyUpb_MethodDescriptor_Getters
static PyGetSetDef PyUpb_MethodDescriptor_Getters[]
Definition: descriptor.c:1385
upb_MessageDef_MiniTable
const upb_MiniTable * upb_MessageDef_MiniTable(const upb_MessageDef *m)
Definition: upb/upb/def.c:818
upb_MessageDef_Syntax
upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef *m)
Definition: upb/upb/def.c:717
PyUpb_FieldDescriptor_GetHasOptions
static PyObject * PyUpb_FieldDescriptor_GetHasOptions(PyUpb_DescriptorBase *_self, void *closure)
Definition: descriptor.c:1008
PyUpb_FileDescriptor_GetEnumTypesByName
static PyObject * PyUpb_FileDescriptor_GetEnumTypesByName(PyObject *_self, void *closure)
Definition: descriptor.c:1173
PyUpb_DescriptorBase_GetOptions
static PyObject * PyUpb_DescriptorBase_GetOptions(PyUpb_DescriptorBase *self, const upb_Message *opts, const upb_MiniTable *layout, const char *msg_name)
Definition: descriptor.c:103
kUpb_FieldType_UInt64
@ kUpb_FieldType_UInt64
Definition: upb/upb/upb.h:312
capstone.range
range
Definition: third_party/bloaty/third_party/capstone/bindings/python/capstone/__init__.py:6
upb_EnumDef_ToProto
google_protobuf_EnumDescriptorProto * upb_EnumDef_ToProto(const upb_EnumDef *e, upb_Arena *a)
Definition: def_to_proto.c:511
upb_MessageDef_NestedMessageCount
int upb_MessageDef_NestedMessageCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:802
PyUpb_CMessage_Verify
bool PyUpb_CMessage_Verify(PyObject *self)
Definition: upb/python/message.c:235
PyUpb_EnumDescriptor_Get
PyObject * PyUpb_EnumDescriptor_Get(const upb_EnumDef *enumdef)
Definition: descriptor.c:649
upb_Decode
upb_DecodeStatus upb_Decode(const char *buf, size_t size, void *msg, const upb_MiniTable *l, const upb_ExtensionRegistry *extreg, int options, upb_Arena *arena)
Definition: decode.c:1076
upb_EnumValueDef_Name
const char * upb_EnumValueDef_Name(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:454
upb_MessageDef
Definition: upb/upb/def.c:100
PyUpb_Descriptor_GetFile
static PyObject * PyUpb_Descriptor_GetFile(PyObject *self, void *closure)
Definition: descriptor.c:481
upb_ServiceDef_Name
const char * upb_ServiceDef_Name(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1051
upb_MethodDef_Name
const char * upb_MethodDef_Name(const upb_MethodDef *m)
Definition: upb/upb/def.c:1012
def_to_proto.h
upb_MessageDef_NestedEnum
const upb_EnumDef * upb_MessageDef_NestedEnum(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:844
PyUpb_Descriptor_LookupNestedMessage
static const void * PyUpb_Descriptor_LookupNestedMessage(const upb_MessageDef *m, const char *name)
Definition: descriptor.c:222
upb_DefPool_ExtensionRegistry
const upb_ExtensionRegistry * upb_DefPool_ExtensionRegistry(const upb_DefPool *s)
Definition: upb/upb/def.c:3231
google_protobuf_OneofOptions_msginit
const upb_MiniTable google_protobuf_OneofOptions_msginit
Definition: descriptor.upb.c:337
upb_MessageDef_HasOptions
bool upb_MessageDef_HasOptions(const upb_MessageDef *m)
Definition: upb/upb/def.c:697
upb_FileDef_Dependency
const upb_FileDef * upb_FileDef_Dependency(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:958
PyUpb_ServiceDescriptor_GetFile
static PyObject * PyUpb_ServiceDescriptor_GetFile(PyObject *self, void *closure)
Definition: descriptor.c:1536
PyUpb_FileDescriptor_LookupService
static const void * PyUpb_FileDescriptor_LookupService(const upb_FileDef *filedef, const char *name)
Definition: descriptor.c:1128
PyUpb_EnumValueDescriptor_GetIndex
static PyObject * PyUpb_EnumValueDescriptor_GetIndex(PyObject *self, void *closure)
Definition: descriptor.c:802
PyUpb_EnumValueDescriptor_GetNumber
static PyObject * PyUpb_EnumValueDescriptor_GetNumber(PyObject *self, void *closure)
Definition: descriptor.c:796
upb_MethodDef_FullName
const char * upb_MethodDef_FullName(const upb_MethodDef *m)
Definition: upb/upb/def.c:1006
kUpb_CType_Bytes
@ kUpb_CType_Bytes
Definition: upb/upb/upb.h:297
PyUpb_DescriptorBase_DoCreate
static PyUpb_DescriptorBase * PyUpb_DescriptorBase_DoCreate(PyUpb_DescriptorType type, const void *def, const upb_FileDef *file)
Definition: descriptor.c:61
upb_MethodDef
Definition: upb/upb/def.c:197
kUpb_DecodeStatus_Ok
@ kUpb_DecodeStatus_Ok
Definition: decode.h:72
PyUpb_UpbToPy
PyObject * PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef *f, PyObject *arena)
Definition: upb/python/convert.c:35
PyUpb_FileDescriptor_GetName
static PyObject * PyUpb_FileDescriptor_GetName(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:1134
PyUpb_MethodDescriptor_GetInputType
static PyObject * PyUpb_MethodDescriptor_GetInputType(PyObject *self, void *closure)
Definition: descriptor.c:1356
PyUpb_FileDescriptor_Getters
static PyGetSetDef PyUpb_FileDescriptor_Getters[]
Definition: descriptor.c:1271
upb_FieldDef_File
const upb_FileDef * upb_FieldDef_File(const upb_FieldDef *f)
Definition: upb/upb/def.c:561
PyUpb_DescriptorBase_Check
static PyUpb_DescriptorBase * PyUpb_DescriptorBase_Check(PyObject *obj, PyUpb_DescriptorType type)
Definition: descriptor.c:91
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
upb_OneofDef_ContainingType
const upb_MessageDef * upb_OneofDef_ContainingType(const upb_OneofDef *o)
Definition: upb/upb/def.c:874
PyUpb_EnumDescriptor_GetFullName
static PyObject * PyUpb_EnumDescriptor_GetFullName(PyObject *self, void *closure)
Definition: descriptor.c:660
cstest_report.opts
opts
Definition: cstest_report.py:81
PyUpb_ModuleState_GetFromModule
PyUpb_ModuleState * PyUpb_ModuleState_GetFromModule(PyObject *module)
Definition: upb/python/protobuf.c:82
status
absl::Status status
Definition: rls.cc:251
PyUpb_CMessage_GetMsgdef
const upb_MessageDef * PyUpb_CMessage_GetMsgdef(PyObject *self)
Definition: upb/python/message.c:220
kUpb_FieldType_SFixed32
@ kUpb_FieldType_SFixed32
Definition: upb/upb/upb.h:323
PyUpb_Descriptor_GetDef
const upb_MessageDef * PyUpb_Descriptor_GetDef(PyObject *_self)
Definition: descriptor.c:639
upb_MiniTable
Definition: msg_internal.h:185
PyUpb_MethodDescriptor_Spec
static PyType_Spec PyUpb_MethodDescriptor_Spec
Definition: descriptor.c:1408
PyUpb_FieldDescriptor_Methods
static PyMethodDef PyUpb_FieldDescriptor_Methods[]
Definition: descriptor.c:1058
setup.name
name
Definition: setup.py:542
upb_OneofDef
Definition: upb/upb/def.c:157
PyUpb_FileDescriptor_GetPublicDependencies
static PyObject * PyUpb_FileDescriptor_GetPublicDependencies(PyObject *_self, void *closure)
Definition: descriptor.c:1229
PyUpb_GenericSequence_New
PyObject * PyUpb_GenericSequence_New(const PyUpb_GenericSequence_Funcs *funcs, const void *parent, PyObject *parent_obj)
Definition: descriptor_containers.c:116
kPyUpb_FileDescriptor
@ kPyUpb_FileDescriptor
Definition: upb/python/descriptor.h:41
upb_FileDef_TopLevelExtensionCount
int upb_FileDef_TopLevelExtensionCount(const upb_FileDef *f)
Definition: upb/upb/def.c:952
kPyUpb_Descriptor
@ kPyUpb_Descriptor
Definition: upb/python/descriptor.h:37
DESCRIPTOR_BASE_SLOTS
#define DESCRIPTOR_BASE_SLOTS
Definition: descriptor.c:195
upb_MessageDef_NestedExtensionCount
int upb_MessageDef_NestedExtensionCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:810
upb_EnumDef_File
const upb_FileDef * upb_EnumDef_File(const upb_EnumDef *e)
Definition: upb/upb/def.c:396
upb_EnumValueDef_HasOptions
bool upb_EnumValueDef_HasOptions(const upb_EnumValueDef *e)
Definition: upb/upb/def.c:442
PyUpb_FieldDescriptor_GetType
static PyObject * PyUpb_FieldDescriptor_GetType(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:903
PyUpb_FieldDescriptor_GetNumber
static PyObject * PyUpb_FieldDescriptor_GetNumber(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:950
PyUpb_Descriptor_GetEnumTypesByName
static PyObject * PyUpb_Descriptor_GetEnumTypesByName(PyObject *_self, void *closure)
Definition: descriptor.c:445
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
kPyUpb_MethodDescriptor
@ kPyUpb_MethodDescriptor
Definition: upb/python/descriptor.h:42
PyUpb_FileDescriptor_GetPackage
static PyObject * PyUpb_FileDescriptor_GetPackage(PyObject *_self, void *closure)
Definition: descriptor.c:1145
PyUpb_FileDescriptor_Methods
static PyMethodDef PyUpb_FileDescriptor_Methods[]
Definition: descriptor.c:1293
kPyUpb_FieldDescriptor
@ kPyUpb_FieldDescriptor
Definition: upb/python/descriptor.h:40
PyUpb_Descriptor_GetNestedTypes
static PyObject * PyUpb_Descriptor_GetNestedTypes(PyObject *_self, void *closure)
Definition: descriptor.c:402
PyUpb_MethodDescriptor_GetContainingService
static PyObject * PyUpb_MethodDescriptor_GetContainingService(PyObject *self, void *closure)
Definition: descriptor.c:1350
upb_Arena_New
UPB_INLINE upb_Arena * upb_Arena_New(void)
Definition: upb/upb/upb.h:267
kUpb_CType_Int64
@ kUpb_CType_Int64
Definition: upb/upb/upb.h:294
PyUpb_FileDescriptor_GetPool
static PyObject * PyUpb_FileDescriptor_GetPool(PyObject *_self, void *closure)
Definition: descriptor.c:1139
PyUpb_ServiceDescriptor_GetName
static PyObject * PyUpb_ServiceDescriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:1530
PyUpb_EnumValueDescriptor_Methods
static PyMethodDef PyUpb_EnumValueDescriptor_Methods[]
Definition: descriptor.c:838
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
upb_ServiceDef_FullName
const char * upb_ServiceDef_FullName(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1047
upb_FileDef_TopLevelEnum
const upb_EnumDef * upb_FileDef_TopLevelEnum(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:978
upb_Message_New
upb_Message * upb_Message_New(const upb_MessageDef *m, upb_Arena *a)
Definition: reflection.c:95
kUpb_FieldType_Double
@ kUpb_FieldType_Double
Definition: upb/upb/upb.h:309
PyUpb_Descriptor_GetFieldsByName
static PyObject * PyUpb_Descriptor_GetFieldsByName(PyObject *_self, void *closure)
Definition: descriptor.c:357
kUpb_FieldType_Bool
@ kUpb_FieldType_Bool
Definition: upb/upb/upb.h:316
kPyUpb_EnumDescriptor
@ kPyUpb_EnumDescriptor
Definition: upb/python/descriptor.h:38
upb_EnumDef_FindValueByNumber
const upb_EnumValueDef * upb_EnumDef_FindValueByNumber(const upb_EnumDef *def, int32_t num)
Definition: upb/upb/def.c:417
PyUpb_EnumValueDescriptor_Getters
static PyGetSetDef PyUpb_EnumValueDescriptor_Getters[]
Definition: descriptor.c:829
PyUpb_FieldDescriptor_GetDefaultValue
static PyObject * PyUpb_FieldDescriptor_GetDefaultValue(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:993
upb_ServiceDef
Definition: upb/upb/def.c:208
upb_FieldDef_Index
uint32_t upb_FieldDef_Index(const upb_FieldDef *f)
Definition: upb/upb/def.c:537
PyUpb_Descriptor_Getters
static PyGetSetDef PyUpb_Descriptor_Getters[]
Definition: descriptor.c:582
kUpb_FieldType_Float
@ kUpb_FieldType_Float
Definition: upb/upb/upb.h:310
upb_EnumDef_HasOptions
bool upb_EnumDef_HasOptions(const upb_EnumDef *e)
Definition: upb/upb/def.c:386
PYUPB_DESCRIPTOR_MODULE
#define PYUPB_DESCRIPTOR_MODULE
Definition: upb/python/protobuf.h:42
upb_FieldDef_Label
upb_Label upb_FieldDef_Label(const upb_FieldDef *f)
Definition: upb/upb/def.c:539
PyUpb_ServiceDescriptor_FindMethodByName
static PyObject * PyUpb_ServiceDescriptor_FindMethodByName(PyObject *_self, PyObject *py_name)
Definition: descriptor.c:1591
PyUpb_OneofDescriptor_Slots
static PyType_Slot PyUpb_OneofDescriptor_Slots[]
Definition: descriptor.c:1495
PyUpb_Descriptor_GetExtensions
static PyObject * PyUpb_Descriptor_GetExtensions(PyObject *_self, void *closure)
Definition: descriptor.c:275
google_protobuf_EnumDescriptorProto_msginit
const upb_MiniTable google_protobuf_EnumDescriptorProto_msginit
Definition: descriptor.upb.c:185
PyUpb_FileDescriptor_GetDef
const upb_FileDef * PyUpb_FileDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:1312
start
static uint64_t start
Definition: benchmark-pound.c:74
kUpb_FieldType_UInt32
@ kUpb_FieldType_UInt32
Definition: upb/upb/upb.h:321
upb_MessageDef_Name
const char * upb_MessageDef_Name(const upb_MessageDef *m)
Definition: upb/upb/def.c:713
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
upb_FileDef_TopLevelExtension
const upb_FieldDef * upb_FileDef_TopLevelExtension(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:983
upb_MethodDef_Options
const google_protobuf_MethodOptions * upb_MethodDef_Options(const upb_MethodDef *m)
Definition: upb/upb/def.c:997
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
PyUpb_Descriptor_GetOneofs
static PyObject * PyUpb_Descriptor_GetOneofs(PyObject *_self, void *closure)
Definition: descriptor.c:311
PyUpb_FileDescriptor_LookupMessage
static const void * PyUpb_FileDescriptor_LookupMessage(const upb_FileDef *filedef, const char *name)
Definition: descriptor.c:1110
benchmark.syntax
syntax
Definition: benchmark.py:90
upb_EnumValueDef_Index
uint32_t upb_EnumValueDef_Index(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:462
PyUpb_FieldDescriptor_HasDefaultValue
static PyObject * PyUpb_FieldDescriptor_HasDefaultValue(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:988
PyUpb_DescriptorType
PyUpb_DescriptorType
Definition: upb/python/descriptor.h:36
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
kUpb_FieldType_String
@ kUpb_FieldType_String
Definition: upb/upb/upb.h:317
PyUpb_SetIntAttr
static bool PyUpb_SetIntAttr(PyObject *obj, const char *name, int val)
Definition: descriptor.c:1638
PyUpb_Dealloc
static void PyUpb_Dealloc(void *self)
Definition: upb/python/protobuf.h:208
PyUpb_EnumDescriptor_Slots
static PyType_Slot PyUpb_EnumDescriptor_Slots[]
Definition: descriptor.c:767
kUpb_CType_Double
@ kUpb_CType_Double
Definition: upb/upb/upb.h:293
upb_EnumDef_Options
const google_protobuf_EnumOptions * upb_EnumDef_Options(const upb_EnumDef *e)
Definition: upb/upb/def.c:382
PyUpb_FieldDescriptor_GetCamelCaseName
static PyObject * PyUpb_FieldDescriptor_GetCamelCaseName(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:885
PyUpb_DescriptorBase_CopyToProto
static PyObject * PyUpb_DescriptorBase_CopyToProto(PyObject *_self, PyUpb_ToProto_Func *func, const upb_MiniTable *layout, const char *expected_type, PyObject *py_proto)
Definition: descriptor.c:165
PyUpb_FieldDescriptor_GetFile
static PyObject * PyUpb_FieldDescriptor_GetFile(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:896
upb_FileDef_Options
const google_protobuf_FileOptions * upb_FileDef_Options(const upb_FileDef *f)
Definition: upb/upb/def.c:912
PyUpb_OneofDescriptor_GetContainingType
static PyObject * PyUpb_OneofDescriptor_GetContainingType(PyObject *self, void *closure)
Definition: descriptor.c:1450
upb_MessageDef_NestedMessage
const upb_MessageDef * upb_MessageDef_NestedMessage(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:838
descriptor_containers.h
PyUpb_ByNumberMap_Funcs
Definition: upb/python/descriptor_containers.h:97
PyUpb_FieldDescriptor_GetMessageType
static PyObject * PyUpb_FieldDescriptor_GetMessageType(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:960
upb_DefPool_FindServiceByName
const upb_ServiceDef * upb_DefPool_FindServiceByName(const upb_DefPool *s, const char *name)
Definition: upb/upb/def.c:1186
descriptor.h
google_protobuf_MethodDescriptorProto_msginit
const upb_MiniTable google_protobuf_MethodDescriptorProto_msginit
Definition: descriptor.upb.c:248
kUpb_Syntax_Proto2
@ kUpb_Syntax_Proto2
Definition: upb/upb/def.h:65
PyUpb_MethodDescriptor_CopyToProto
static PyObject * PyUpb_MethodDescriptor_CopyToProto(PyObject *_self, PyObject *py_proto)
Definition: descriptor.c:1377
kUpb_FieldType_Enum
@ kUpb_FieldType_Enum
Definition: upb/upb/upb.h:322
kPyUpb_Descriptor_Count
@ kPyUpb_Descriptor_Count
Definition: upb/python/descriptor.h:45
kUpb_FieldType_Fixed32
@ kUpb_FieldType_Fixed32
Definition: upb/upb/upb.h:315
upb_FileDef_TopLevelMessage
const upb_MessageDef * upb_FileDef_TopLevelMessage(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:973
PyUpb_OneofDescriptor_GetIndex
static PyObject * PyUpb_OneofDescriptor_GetIndex(PyObject *self, void *closure)
Definition: descriptor.c:1445
PyUpb_Descriptor_Get
PyObject * PyUpb_Descriptor_Get(const upb_MessageDef *m)
Definition: descriptor.c:204
upb_FileDef_Pool
const upb_DefPool * upb_FileDef_Pool(const upb_FileDef *f)
Definition: upb/upb/def.c:993
PyUpb_MethodDescriptor_GetFullName
static PyObject * PyUpb_MethodDescriptor_GetFullName(PyObject *self, void *closure)
Definition: descriptor.c:1338
upb_OneofDef_FieldCount
int upb_OneofDef_FieldCount(const upb_OneofDef *o)
Definition: upb/upb/def.c:878
upb_EnumValueDef
Definition: upb/upb/def.c:150
PyUpb_FieldDescriptor_Getters
static PyGetSetDef PyUpb_FieldDescriptor_Getters[]
Definition: descriptor.c:1023
upb_EnumDef_FullName
const char * upb_EnumDef_FullName(const upb_EnumDef *e)
Definition: upb/upb/def.c:390
PyUpb_FieldDescriptor_GetName
static PyObject * PyUpb_FieldDescriptor_GetName(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:880
def
int def(FILE *source, FILE *dest, int level)
Definition: bloaty/third_party/zlib/examples/zpipe.c:36
upb_FieldDef_Default
upb_MessageValue upb_FieldDef_Default(const upb_FieldDef *f)
Definition: upb/upb/def.c:581
PyUpb_Descriptor_LookupNestedExtension
static const void * PyUpb_Descriptor_LookupNestedExtension(const upb_MessageDef *m, const char *name)
Definition: descriptor.c:246
google_protobuf_DescriptorProto_msginit
const upb_MiniTable google_protobuf_DescriptorProto_msginit
Definition: descriptor.upb.c:83
upb_FieldDef_IsExtension
bool upb_FieldDef_IsExtension(const upb_FieldDef *f)
Definition: upb/upb/def.c:543
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
PyUpb_Descriptor_GetFieldsByNumber
static PyObject * PyUpb_Descriptor_GetFieldsByNumber(PyObject *_self, void *closure)
Definition: descriptor.c:387
upb_FileDef_Name
const char * upb_FileDef_Name(const upb_FileDef *f)
Definition: upb/upb/def.c:920
PyUpb_DescriptorBase_GetSerializedProto
static PyObject * PyUpb_DescriptorBase_GetSerializedProto(PyObject *_self, PyUpb_ToProto_Func *func, const upb_MiniTable *layout)
Definition: descriptor.c:145
PyUpb_ServiceDescriptor_Getters
static PyGetSetDef PyUpb_ServiceDescriptor_Getters[]
Definition: descriptor.c:1604
PyUpb_AddClass
PyTypeObject * PyUpb_AddClass(PyObject *m, PyType_Spec *spec)
Definition: upb/python/protobuf.c:274
upb_MessageDef_FindFieldByName
const UPB_INLINE upb_FieldDef * upb_MessageDef_FindFieldByName(const upb_MessageDef *m, const char *name)
Definition: upb/upb/def.h:204
PyUpb_OneofDescriptor_Spec
static PyType_Spec PyUpb_OneofDescriptor_Spec
Definition: descriptor.c:1501
PyUpb_EnumDescriptor_GetFile
static PyObject * PyUpb_EnumDescriptor_GetFile(PyObject *self, void *closure)
Definition: descriptor.c:671
PyUpb_FieldDescriptor_Get
PyObject * PyUpb_FieldDescriptor_Get(const upb_FieldDef *field)
Definition: descriptor.c:870
upb_OneofDef_HasOptions
bool upb_OneofDef_HasOptions(const upb_OneofDef *o)
Definition: upb/upb/def.c:866
PyUpb_FieldDescriptor_GetIndex
static PyObject * PyUpb_FieldDescriptor_GetIndex(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:955
PyUpb_Descriptor_GetEnumValuesByName
static PyObject * PyUpb_Descriptor_GetEnumValuesByName(PyObject *_self, void *closure)
Definition: descriptor.c:507
PyUpb_DescriptorBase::PyObject_HEAD
PyObject_HEAD
Definition: descriptor.c:45
gen_synthetic_protos.base
base
Definition: gen_synthetic_protos.py:31
upb_MethodDef_Index
int upb_MethodDef_Index(const upb_MethodDef *m)
Definition: upb/upb/def.c:1010
PyUpb_FieldDescriptor_GetCppType
static PyObject * PyUpb_FieldDescriptor_GetCppType(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:908
PyUpb_EnumDescriptor_GetContainingType
static PyObject * PyUpb_EnumDescriptor_GetContainingType(PyObject *_self, void *closure)
Definition: descriptor.c:717
upb_EnumValueDef_Options
const google_protobuf_EnumValueOptions * upb_EnumValueDef_Options(const upb_EnumValueDef *e)
Definition: upb/upb/def.c:437
upb_FieldDef_CType
upb_CType upb_FieldDef_CType(const upb_FieldDef *f)
Definition: upb/upb/def.c:500
upb_FileDef_Service
const upb_ServiceDef * upb_FileDef_Service(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:988
upb_EnumDef_ValueCount
int upb_EnumDef_ValueCount(const upb_EnumDef *e)
Definition: upb/upb/def.c:407
upb_ExtensionRange_Start
int32_t upb_ExtensionRange_Start(const upb_ExtensionRange *e)
Definition: upb/upb/def.c:479
upb_FileDef_TopLevelEnumCount
int upb_FileDef_TopLevelEnumCount(const upb_FileDef *f)
Definition: upb/upb/def.c:948
upb_ExtensionRange_End
int32_t upb_ExtensionRange_End(const upb_ExtensionRange *e)
Definition: upb/upb/def.c:483
kUpb_Label_Required
@ kUpb_Label_Required
Definition: upb/upb/upb.h:303
upb_OneofDef_Options
const google_protobuf_OneofOptions * upb_OneofDef_Options(const upb_OneofDef *o)
Definition: upb/upb/def.c:861
PyUpb_ByNameMap_Funcs
Definition: upb/python/descriptor_containers.h:76
PyUpb_Descriptor_Spec
static PyType_Spec PyUpb_Descriptor_Spec
Definition: descriptor.c:631
PyUpb_DescriptorPool_Get
PyObject * PyUpb_DescriptorPool_Get(const upb_DefPool *symtab)
Definition: descriptor_pool.c:92
layout
MessageLayout * layout
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:809
PyUpb_FileDescriptor_Spec
static PyType_Spec PyUpb_FileDescriptor_Spec
Definition: descriptor.c:1304
protobuf.h
upb_MessageDef_Oneof
const upb_OneofDef * upb_MessageDef_Oneof(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:833
PyUpb_FieldDescriptor_Slots
static PyType_Slot PyUpb_FieldDescriptor_Slots[]
Definition: descriptor.c:1066
PyUpb_FileDescriptor_GetMessageTypesByName
static PyObject * PyUpb_FileDescriptor_GetMessageTypesByName(PyObject *_self, void *closure)
Definition: descriptor.c:1158
PyUpb_ByNameMap_New
PyObject * PyUpb_ByNameMap_New(const PyUpb_ByNameMap_Funcs *funcs, const void *parent, PyObject *parent_obj)
Definition: descriptor_containers.c:288
upb_Message
void upb_Message
Definition: msg.h:49
PyUpb_Descriptor_CopyToProto
static PyObject * PyUpb_Descriptor_CopyToProto(PyObject *_self, PyObject *py_proto)
Definition: descriptor.c:329
PyUpb_DescriptorBase::def
const void * def
Definition: descriptor.c:47
upb_FieldDef_MessageSubDef
const upb_MessageDef * upb_FieldDef_MessageSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:619
PyUpb_ByNumberMap_New
PyObject * PyUpb_ByNumberMap_New(const PyUpb_ByNumberMap_Funcs *funcs, const void *parent, PyObject *parent_obj)
Definition: descriptor_containers.c:491
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
upb_MethodDef_InputType
const upb_MessageDef * upb_MethodDef_InputType(const upb_MethodDef *m)
Definition: upb/upb/def.c:1020
PyUpb_FieldDescriptor_GetDef
const upb_FieldDef * PyUpb_FieldDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:864
upb_FieldDef_EnumSubDef
const upb_EnumDef * upb_FieldDef_EnumSubDef(const upb_FieldDef *f)
Definition: upb/upb/def.c:623
PyUpb_Descriptor_GetContainingType
static PyObject * PyUpb_Descriptor_GetContainingType(PyObject *_self, void *closure)
Definition: descriptor.c:428
upb_FieldDef_HasOptions
bool upb_FieldDef_HasOptions(const upb_FieldDef *f)
Definition: upb/upb/def.c:492
upb_FieldDef
Definition: upb/upb/def.c:56
upb_MessageDef_ExtensionRangeCount
int upb_MessageDef_ExtensionRangeCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:790
kUpb_CType_Float
@ kUpb_CType_Float
Definition: upb/upb/upb.h:288
upb_ServiceDef_Method
const upb_MethodDef * upb_ServiceDef_Method(const upb_ServiceDef *s, int i)
Definition: upb/upb/def.c:1065
PyUpb_EnumDescriptor_GetName
static PyObject * PyUpb_EnumDescriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:666
PyUpb_OneofDescriptor_Get
PyObject * PyUpb_OneofDescriptor_Get(const upb_OneofDef *oneof)
Definition: descriptor.c:1426
PyUpb_Descriptor_GetFullName
static PyObject * PyUpb_Descriptor_GetFullName(PyObject *self, void *closure)
Definition: descriptor.c:470
google_protobuf_ServiceDescriptorProto_msginit
const upb_MiniTable google_protobuf_ServiceDescriptorProto_msginit
Definition: descriptor.upb.c:229
PyUpb_EnumValueDescriptor_Spec
static PyType_Spec PyUpb_EnumValueDescriptor_Spec
Definition: descriptor.c:852
PyUpb_EnumValueDescriptor_GetOptions
static PyObject * PyUpb_EnumValueDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:820
PyUpb_EnumDescriptor_GetValuesByName
static PyObject * PyUpb_EnumDescriptor_GetValuesByName(PyObject *_self, void *closure)
Definition: descriptor.c:687
PyUpb_FieldDescriptor_GetExtensionScope
static PyObject * PyUpb_FieldDescriptor_GetExtensionScope(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:981
PyUpb_EnumDescriptor_GetDef
const upb_EnumDef * PyUpb_EnumDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:654
PyUpb_FileDescriptor_LookupFunc
const typedef void * PyUpb_FileDescriptor_LookupFunc(const upb_DefPool *, const char *)
PyUpb_ObjCache_Get
PyObject * PyUpb_ObjCache_Get(const void *key)
Definition: upb/python/protobuf.c:206
kUpb_FieldType_Fixed64
@ kUpb_FieldType_Fixed64
Definition: upb/upb/upb.h:314
PyUpb_FileDescriptor_LookupExtension
static const void * PyUpb_FileDescriptor_LookupExtension(const upb_FileDef *filedef, const char *name)
Definition: descriptor.c:1122
PyUpb_DescriptorBase::pool
PyObject * pool
Definition: descriptor.c:46
symtab
upb_symtab * symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:774
PyUpb_DescriptorPool_GetSymtab
upb_DefPool * PyUpb_DescriptorPool_GetSymtab(PyObject *pool)
Definition: descriptor_pool.c:77
PyUpb_ModuleState_Get
PyUpb_ModuleState * PyUpb_ModuleState_Get(void)
Definition: upb/python/protobuf.c:89
upb_MessageDef_FindByJsonName
const UPB_INLINE upb_FieldDef * upb_MessageDef_FindByJsonName(const upb_MessageDef *m, const char *name)
Definition: upb/upb/def.h:241
PyUpb_Descriptor_GetExtensionsByName
static PyObject * PyUpb_Descriptor_GetExtensionsByName(PyObject *_self, void *closure)
Definition: descriptor.c:286
message.h
PyUpb_OneofDescriptor_Methods
static PyMethodDef PyUpb_OneofDescriptor_Methods[]
Definition: descriptor.c:1492
PyUpb_MethodDescriptor_Methods
static PyMethodDef PyUpb_MethodDescriptor_Methods[]
Definition: descriptor.c:1397
upb_MessageDef_Options
const google_protobuf_MessageOptions * upb_MessageDef_Options(const upb_MessageDef *m)
Definition: upb/upb/def.c:692
PyUpb_OneofDescriptor_Getters
static PyGetSetDef PyUpb_OneofDescriptor_Getters[]
Definition: descriptor.c:1482
PyUpb_EnumValueDescriptor_GetType
static PyObject * PyUpb_EnumValueDescriptor_GetType(PyObject *self, void *closure)
Definition: descriptor.c:808
PyUpb_ServiceDescriptor_GetOptions
static PyObject * PyUpb_ServiceDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:1574
upb_Encode
char * upb_Encode(const void *msg, const upb_MiniTable *l, int options, upb_Arena *arena, size_t *size)
Definition: encode.c:573
PyUpb_FieldDescriptor_GetLabel
static PyObject * PyUpb_FieldDescriptor_GetLabel(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:940
PYUPB_RETURN_OOM
#define PYUPB_RETURN_OOM
Definition: upb/python/protobuf.h:54
PyUpb_Descriptor_Methods
static PyMethodDef PyUpb_Descriptor_Methods[]
Definition: descriptor.c:619
PyUpb_Arena_Get
upb_Arena * PyUpb_Arena_Get(PyObject *arena)
Definition: upb/python/protobuf.c:231
PyUpb_DescriptorBase
Definition: descriptor.c:44
upb_FieldDef_ContainingType
const upb_MessageDef * upb_FieldDef_ContainingType(const upb_FieldDef *f)
Definition: upb/upb/def.c:563
google_protobuf_FileDescriptorProto_msginit
const upb_MiniTable google_protobuf_FileDescriptorProto_msginit
Definition: descriptor.upb.c:53
PyUpb_ServiceDescriptor_GetMethodsByName
static PyObject * PyUpb_ServiceDescriptor_GetMethodsByName(PyObject *_self, void *closure)
Definition: descriptor.c:1559
PyUpb_Descriptor_GetOneofsByName
static PyObject * PyUpb_Descriptor_GetOneofsByName(PyObject *_self, void *closure)
Definition: descriptor.c:560
PyUpb_ServiceDescriptor_GetDef
const upb_ServiceDef * PyUpb_ServiceDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:1513
upb_OneofDef_Index
uint32_t upb_OneofDef_Index(const upb_OneofDef *o)
Definition: upb/upb/def.c:887
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
func
const EVP_CIPHER *(* func)(void)
Definition: cipher_extra.c:73
PyUpb_EnumDescriptor_GetValues
static PyObject * PyUpb_EnumDescriptor_GetValues(PyObject *_self, void *closure)
Definition: descriptor.c:676
PyUpb_InitDescriptor
bool PyUpb_InitDescriptor(PyObject *m)
Definition: descriptor.c:1654
upb_FileDef_ServiceCount
int upb_FileDef_ServiceCount(const upb_FileDef *f)
Definition: upb/upb/def.c:956
PyUpb_Arena_New
PyObject * PyUpb_Arena_New(void)
Definition: upb/python/protobuf.c:219
PYUPB_MODULE_NAME
#define PYUPB_MODULE_NAME
Definition: upb/python/protobuf.h:43
PyUpb_GenericSequence_Funcs
Definition: upb/python/descriptor_containers.h:54
upb_FieldDef_JsonName
const char * upb_FieldDef_JsonName(const upb_FieldDef *f)
Definition: upb/upb/def.c:553
kUpb_Label_Repeated
@ kUpb_Label_Repeated
Definition: upb/upb/upb.h:304
upb_MessageDef_FindOneofByName
const UPB_INLINE upb_OneofDef * upb_MessageDef_FindOneofByName(const upb_MessageDef *m, const char *name)
Definition: upb/upb/def.h:199
upb_FileDef
Definition: upb/upb/def.c:171
PyUpb_EnumValueDescriptor_GetHasOptions
static PyObject * PyUpb_EnumValueDescriptor_GetHasOptions(PyObject *_self, void *closure)
Definition: descriptor.c:814
def.h
upb_OneofDef_Field
const upb_FieldDef * upb_OneofDef_Field(const upb_OneofDef *o, int i)
Definition: upb/upb/def.c:880
PyUpb_MethodDescriptor_GetDef
const upb_MethodDef * PyUpb_MethodDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:1322
upb_ExtensionRange
Definition: upb/upb/def.c:94
PyUpb_EnumDescriptor_Getters
static PyGetSetDef PyUpb_EnumDescriptor_Getters[]
Definition: descriptor.c:748
PyUpb_ServiceDescriptor_Spec
static PyType_Spec PyUpb_ServiceDescriptor_Spec
Definition: descriptor.c:1626
upb_MessageDef_NestedExtension
const upb_FieldDef * upb_MessageDef_NestedExtension(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:849
PyUpb_CMessage_MergeFromString
PyObject * PyUpb_CMessage_MergeFromString(PyObject *_self, PyObject *arg)
Definition: upb/python/message.c:1129
PyUpb_Descriptor_GetIsExtendable
static PyObject * PyUpb_Descriptor_GetIsExtendable(PyObject *_self, void *closure)
Definition: descriptor.c:460
PyUpb_ServiceDescriptor_GetFullName
static PyObject * PyUpb_ServiceDescriptor_GetFullName(PyObject *self, void *closure)
Definition: descriptor.c:1524
upb_FieldDef_IsRepeated
bool upb_FieldDef_IsRepeated(const upb_FieldDef *f)
Definition: upb/upb/def.c:651
PyUpb_EnumValueDescriptor_Get
PyObject * PyUpb_EnumValueDescriptor_Get(const upb_EnumValueDef *ev)
Definition: descriptor.c:785
upb_DefPool_FindMessageByNameWithSize
const upb_MessageDef * upb_DefPool_FindMessageByNameWithSize(const upb_DefPool *s, const char *sym, size_t len)
Definition: upb/upb/def.c:1130
PyUpb_ModuleState
Definition: upb/python/protobuf.h:66
upb_ServiceDef_Options
const google_protobuf_ServiceOptions * upb_ServiceDef_Options(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1038
kPyUpb_ServiceDescriptor
@ kPyUpb_ServiceDescriptor
Definition: upb/python/descriptor.h:44
desc_specs
static PyType_Spec * desc_specs[]
Definition: descriptor.c:1647
PyUpb_ObjCache_Add
void PyUpb_ObjCache_Add(const void *key, PyObject *py_obj)
Definition: upb/python/protobuf.c:190
upb_EnumDef_Name
const char * upb_EnumDef_Name(const upb_EnumDef *e)
Definition: upb/upb/def.c:392
PyUpb_FileDescriptor_Slots
static PyType_Slot PyUpb_FileDescriptor_Slots[]
Definition: descriptor.c:1298
PyUpb_MethodDescriptor_Slots
static PyType_Slot PyUpb_MethodDescriptor_Slots[]
Definition: descriptor.c:1402
PyUpb_EnumDescriptor_Methods
static PyMethodDef PyUpb_EnumDescriptor_Methods[]
Definition: descriptor.c:762
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
google_protobuf_FileOptions_msginit
const upb_MiniTable google_protobuf_FileOptions_msginit
Definition: descriptor.upb.c:283
kUpb_FieldType_Group
@ kUpb_FieldType_Group
Definition: upb/upb/upb.h:318
google_protobuf_MessageOptions_msginit
const upb_MiniTable google_protobuf_MessageOptions_msginit
Definition: descriptor.upb.c:301
upb_MessageDef_OneofCount
int upb_MessageDef_OneofCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:798
upb_FileDef_PublicDependencyCount
int upb_FileDef_PublicDependencyCount(const upb_FileDef *f)
Definition: upb/upb/def.c:932
msgdef
const upb_msgdef * msgdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:808
upb_ServiceDef_File
const upb_FileDef * upb_ServiceDef_File(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1057
PyUpb_Descriptor_GetHasOptions
static PyObject * PyUpb_Descriptor_GetHasOptions(PyObject *_self, void *closure)
Definition: descriptor.c:496
PYUPB_DESCRIPTOR_PROTO_PACKAGE
#define PYUPB_DESCRIPTOR_PROTO_PACKAGE
Definition: upb/python/protobuf.h:41
PyUpb_FileDescriptor_GetSerializedPb
static PyObject * PyUpb_FileDescriptor_GetSerializedPb(PyObject *self, void *closure)
Definition: descriptor.c:1151
xds_manager.num
num
Definition: xds_manager.py:56
enumdef
const upb_enumdef * enumdef
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:839
ok
bool ok
Definition: async_end2end_test.cc:197
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
PyUpb_ServiceDescriptor_Methods
static PyMethodDef PyUpb_ServiceDescriptor_Methods[]
Definition: descriptor.c:1614
desc
#define desc
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:338
upb_DefPool_FindExtensionByName
const upb_FieldDef * upb_DefPool_FindExtensionByName(const upb_DefPool *s, const char *sym)
Definition: upb/upb/def.c:1181
upb_MessageDef_FullName
const char * upb_MessageDef_FullName(const upb_MessageDef *m)
Definition: upb/upb/def.c:701
PyUpb_FieldDescriptor_Spec
static PyType_Spec PyUpb_FieldDescriptor_Spec
Definition: descriptor.c:1072
closure
Definition: proxy.cc:59
PyUpb_MethodDescriptor_GetName
static PyObject * PyUpb_MethodDescriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:1333
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
PyUpb_FieldDescriptor_GetFullName
static PyObject * PyUpb_FieldDescriptor_GetFullName(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:875
PyUpb_FileDescriptor_LookupEnum
static const void * PyUpb_FileDescriptor_LookupEnum(const upb_FileDef *filedef, const char *name)
Definition: descriptor.c:1116
PyUpb_AnyDescriptor_GetPool
PyObject * PyUpb_AnyDescriptor_GetPool(PyObject *desc)
Definition: descriptor.c:51
kUpb_FieldType_Message
@ kUpb_FieldType_Message
Definition: upb/upb/upb.h:319
PyUpb_AnyDescriptor_GetDef
const void * PyUpb_AnyDescriptor_GetDef(PyObject *desc)
Definition: descriptor.c:56
PyUpb_Descriptor_GetName
static PyObject * PyUpb_Descriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:502
upb_FieldDef_IsSubMessage
bool upb_FieldDef_IsSubMessage(const upb_FieldDef *f)
Definition: upb/upb/def.c:642
kUpb_CType_Bool
@ kUpb_CType_Bool
Definition: upb/upb/upb.h:287
PyUpb_OneofDescriptor_GetFullName
static PyObject * PyUpb_OneofDescriptor_GetFullName(PyObject *self, void *closure)
Definition: descriptor.c:1437
upb_FieldDef_ContainingOneof
const upb_OneofDef * upb_FieldDef_ContainingOneof(const upb_FieldDef *f)
Definition: upb/upb/def.c:571
PyUpb_FileDescriptor_Get
PyObject * PyUpb_FileDescriptor_Get(const upb_FileDef *file)
Definition: descriptor.c:1084
PyUpb_Descriptor_GetFieldsByCamelCaseName
static PyObject * PyUpb_Descriptor_GetFieldsByCamelCaseName(PyObject *_self, void *closure)
Definition: descriptor.c:372
kUpb_CType_Enum
@ kUpb_CType_Enum
Definition: upb/upb/upb.h:291
upb_MessageDef_ToProto
google_protobuf_DescriptorProto * upb_MessageDef_ToProto(const upb_MessageDef *m, upb_Arena *a)
Definition: def_to_proto.c:504
PyUpb_OneofDescriptor_GetOptions
static PyObject * PyUpb_OneofDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:1473
upb_EnumDef
Definition: upb/upb/def.c:134
upb_FileDef_PublicDependency
const upb_FileDef * upb_FileDef_PublicDependency(const upb_FileDef *f, int i)
Definition: upb/upb/def.c:963
upb_MessageDef_NestedEnumCount
int upb_MessageDef_NestedEnumCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:806
PyUpb_MethodDescriptor_GetOptions
static PyObject * PyUpb_MethodDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:1368
PyUpb_EnumDescriptor_GetHasOptions
static PyObject * PyUpb_EnumDescriptor_GetHasOptions(PyObject *_self, void *closure)
Definition: descriptor.c:725
PyUpb_Descriptor_GetClass
PyObject * PyUpb_Descriptor_GetClass(const upb_MessageDef *m)
Definition: descriptor.c:210
PyUpb_DescriptorBase_Dealloc
static void PyUpb_DescriptorBase_Dealloc(PyUpb_DescriptorBase *base)
Definition: descriptor.c:188
PyUpb_FileDescriptor_NestedLookup
static const void * PyUpb_FileDescriptor_NestedLookup(const upb_FileDef *filedef, const char *name, PyUpb_FileDescriptor_LookupFunc *func)
Definition: descriptor.c:1095
upb_FileDef_ToProto
google_protobuf_FileDescriptorProto * upb_FileDef_ToProto(const upb_FileDef *f, upb_Arena *a)
Definition: def_to_proto.c:539
upb_MethodDef_OutputType
const upb_MessageDef * upb_MethodDef_OutputType(const upb_MethodDef *m)
Definition: upb/upb/def.c:1024
google_protobuf_MethodOptions_msginit
const upb_MiniTable google_protobuf_MethodOptions_msginit
Definition: php-upb.c:4488
PyUpb_ServiceDescriptor_GetIndex
static PyObject * PyUpb_ServiceDescriptor_GetIndex(PyObject *self, void *closure)
Definition: descriptor.c:1542
upb_FieldDef_Name
const char * upb_FieldDef_Name(const upb_FieldDef *f)
Definition: upb/upb/def.c:549
upb_ServiceDef_Index
int upb_ServiceDef_Index(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1055
google_protobuf_ServiceOptions_msginit
const upb_MiniTable google_protobuf_ServiceOptions_msginit
Definition: php-upb.c:4487
google_protobuf_EnumValueOptions_msginit
const upb_MiniTable google_protobuf_EnumValueOptions_msginit
Definition: php-upb.c:4486
upb_EnumValueDef_Enum
const upb_EnumDef * upb_EnumValueDef_Enum(const upb_EnumValueDef *ev)
Definition: upb/upb/def.c:446
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
PyUpb_EnumDescriptor_GetOptions
static PyObject * PyUpb_EnumDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:731
PyUpb_MethodDescriptor_GetIndex
static PyObject * PyUpb_MethodDescriptor_GetIndex(PyObject *self, void *closure)
Definition: descriptor.c:1344
descriptor_pool.h
PyUpb_FileDescriptor_CopyToProto
static PyObject * PyUpb_FileDescriptor_CopyToProto(PyObject *_self, PyObject *py_proto)
Definition: descriptor.c:1263
upb_MessageDef_FieldCount
int upb_MessageDef_FieldCount(const upb_MessageDef *m)
Definition: upb/upb/def.c:794
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
PyUpb_Descriptor_GetFields
static PyObject * PyUpb_Descriptor_GetFields(PyObject *_self, void *closure)
Definition: descriptor.c:486
kUpb_FieldType_Int32
@ kUpb_FieldType_Int32
Definition: upb/upb/upb.h:313
PyUpb_FileDescriptor_GetExtensionsByName
static PyObject * PyUpb_FileDescriptor_GetExtensionsByName(PyObject *_self, void *closure)
Definition: descriptor.c:1188
kPyUpb_OneofDescriptor
@ kPyUpb_OneofDescriptor
Definition: upb/python/descriptor.h:43
google_protobuf_FieldOptions_msginit
const upb_MiniTable google_protobuf_FieldOptions_msginit
Definition: php-upb.c:4483
upb_FieldDef_ExtensionScope
const upb_MessageDef * upb_FieldDef_ExtensionScope(const upb_FieldDef *f)
Definition: upb/upb/def.c:567
self
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:543
upb_MessageDef_Field
const upb_FieldDef * upb_MessageDef_Field(const upb_MessageDef *m, int i)
Definition: upb/upb/def.c:828
regress.m
m
Definition: regress/regress.py:25
method
NSString * method
Definition: ProtoMethod.h:28
kPyUpb_EnumValueDescriptor
@ kPyUpb_EnumValueDescriptor
Definition: upb/python/descriptor.h:39
PyUpb_ObjCache_Delete
void PyUpb_ObjCache_Delete(const void *key)
Definition: upb/python/protobuf.c:194
upb_ServiceDef_MethodCount
int upb_ServiceDef_MethodCount(const upb_ServiceDef *s)
Definition: upb/upb/def.c:1061
PyUpb_OneofDescriptor_GetDef
const upb_OneofDef * PyUpb_OneofDescriptor_GetDef(PyObject *_self)
Definition: descriptor.c:1420
kUpb_FieldType_Int64
@ kUpb_FieldType_Int64
Definition: upb/upb/upb.h:311
upb_FieldDef_Options
const google_protobuf_FieldOptions * upb_FieldDef_Options(const upb_FieldDef *f)
Definition: upb/upb/def.c:487
PyUpb_FileDescriptor_GetOptions
static PyObject * PyUpb_FileDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:1254
upb_ServiceDef_ToProto
google_protobuf_ServiceDescriptorProto * upb_ServiceDef_ToProto(const upb_ServiceDef *s, upb_Arena *a)
Definition: def_to_proto.c:553
upb_DefPool
Definition: upb/upb/def.c:217
PyUpb_ServiceDescriptor_GetMethods
static PyObject * PyUpb_ServiceDescriptor_GetMethods(PyObject *_self, void *closure)
Definition: descriptor.c:1548
upb_MessageDef_FindFieldByNumber
const upb_FieldDef * upb_MessageDef_FindFieldByNumber(const upb_MessageDef *m, uint32_t i)
Definition: upb/upb/def.c:721
kUpb_Label_Optional
@ kUpb_Label_Optional
Definition: upb/upb/upb.h:302
PyUpb_OneofDescriptor_GetName
static PyObject * PyUpb_OneofDescriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:1432
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
PyUpb_OneofDescriptor_GetFields
static PyObject * PyUpb_OneofDescriptor_GetFields(PyObject *_self, void *closure)
Definition: descriptor.c:1462
PyUpb_EnumDescriptor_CopyToProto
static PyObject * PyUpb_EnumDescriptor_CopyToProto(PyObject *_self, PyObject *py_proto)
Definition: descriptor.c:740
PyUpb_OneofDescriptor_GetHasOptions
static PyObject * PyUpb_OneofDescriptor_GetHasOptions(PyObject *_self, void *closure)
Definition: descriptor.c:1456
upb_DefPool_FindMessageByName
const upb_MessageDef * upb_DefPool_FindMessageByName(const upb_DefPool *s, const char *sym)
Definition: upb/upb/def.c:1125
PyUpb_Descriptor_Slots
static PyType_Slot PyUpb_Descriptor_Slots[]
Definition: descriptor.c:625
PyUpb_Descriptor_GetEnumTypes
static PyObject * PyUpb_Descriptor_GetEnumTypes(PyObject *_self, void *closure)
Definition: descriptor.c:301
upb_Arena_Free
void upb_Arena_Free(upb_Arena *a)
Definition: upb/upb/upb.c:273
PyUpb_EnumValueDescriptor_Slots
static PyType_Slot PyUpb_EnumValueDescriptor_Slots[]
Definition: descriptor.c:846
PyUpb_Descriptor_GetConcreteClass
static PyObject * PyUpb_Descriptor_GetConcreteClass(PyObject *self, void *closure)
Definition: descriptor.c:475
PyUpb_FieldDescriptor_GetJsonName
static PyObject * PyUpb_FieldDescriptor_GetJsonName(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:891
upb_FileDef_HasOptions
bool upb_FileDef_HasOptions(const upb_FileDef *f)
Definition: upb/upb/def.c:916
PyUpb_EnumValueDescriptor_GetName
static PyObject * PyUpb_EnumValueDescriptor_GetName(PyObject *self, void *closure)
Definition: descriptor.c:790
upb_FieldDef_FullName
const char * upb_FieldDef_FullName(const upb_FieldDef *f)
Definition: upb/upb/def.c:496
PyUpb_ServiceDescriptor_CopyToProto
static PyObject * PyUpb_ServiceDescriptor_CopyToProto(PyObject *_self, PyObject *py_proto)
Definition: descriptor.c:1583
upb_MethodDef_Service
const upb_ServiceDef * upb_MethodDef_Service(const upb_MethodDef *m)
Definition: upb/upb/def.c:1016
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_EnumDescriptor_Spec
static PyType_Spec PyUpb_EnumDescriptor_Spec
Definition: descriptor.c:773
upb_ServiceDef_FindMethodByName
const upb_MethodDef * upb_ServiceDef_FindMethodByName(const upb_ServiceDef *s, const char *name)
Definition: upb/upb/def.c:1069
PyUpb_EnumDescriptor_GetValuesByNumber
static PyObject * PyUpb_EnumDescriptor_GetValuesByNumber(PyObject *_self, void *closure)
Definition: descriptor.c:702
PyUpb_Descriptor_GetNestedTypesByName
static PyObject * PyUpb_Descriptor_GetNestedTypesByName(PyObject *_self, void *closure)
Definition: descriptor.c:413
PyUpb_FileDescriptor_GetDependencies
static PyObject * PyUpb_FileDescriptor_GetDependencies(PyObject *_self, void *closure)
Definition: descriptor.c:1218
upb_EnumDef_Value
const upb_EnumValueDef * upb_EnumDef_Value(const upb_EnumDef *e, int i)
Definition: upb/upb/def.c:430
upb_EnumDef_FindValueByName
const UPB_INLINE upb_EnumValueDef * upb_EnumDef_FindValueByName(const upb_EnumDef *e, const char *name)
Definition: upb/upb/def.h:273
upb_FileDef_TopLevelMessageCount
int upb_FileDef_TopLevelMessageCount(const upb_FileDef *f)
Definition: upb/upb/def.c:926
kUpb_FieldType_Bytes
@ kUpb_FieldType_Bytes
Definition: upb/upb/upb.h:320
PyUpb_FieldDescriptor_GetOptions
static PyObject * PyUpb_FieldDescriptor_GetOptions(PyObject *_self, PyObject *args)
Definition: descriptor.c:1014
PyUpb_FieldDescriptor_GetContainingType
static PyObject * PyUpb_FieldDescriptor_GetContainingType(PyUpb_DescriptorBase *self, void *closure)
Definition: descriptor.c:974
upb_FileDef_DependencyCount
int upb_FileDef_DependencyCount(const upb_FileDef *f)
Definition: upb/upb/def.c:930
PyUpb_MethodDescriptor_GetOutputType
static PyObject * PyUpb_MethodDescriptor_GetOutputType(PyObject *self, void *closure)
Definition: descriptor.c:1362


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:09