protobuf/python/google/protobuf/pyext/extension_dict.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: anuraag@google.com (Anuraag Agrawal)
32 // Author: tibell@google.com (Johan Tibell)
33 
34 #include <google/protobuf/pyext/extension_dict.h>
35 
36 #include <cstdint>
37 #include <memory>
38 
39 #include <google/protobuf/stubs/logging.h>
40 #include <google/protobuf/stubs/common.h>
41 #include <google/protobuf/descriptor.pb.h>
42 #include <google/protobuf/descriptor.h>
43 #include <google/protobuf/dynamic_message.h>
44 #include <google/protobuf/message.h>
45 #include <google/protobuf/pyext/descriptor.h>
46 #include <google/protobuf/pyext/message.h>
47 #include <google/protobuf/pyext/message_factory.h>
48 #include <google/protobuf/pyext/repeated_composite_container.h>
49 #include <google/protobuf/pyext/repeated_scalar_container.h>
50 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
51 
52 #define PyString_AsStringAndSize(ob, charpp, sizep) \
53  (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>( \
54  PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
55  ? -1 \
56  : 0) \
57  : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
58 
59 namespace google {
60 namespace protobuf {
61 namespace python {
62 
63 namespace extension_dict {
64 
65 static Py_ssize_t len(ExtensionDict* self) {
66  Py_ssize_t size = 0;
67  std::vector<const FieldDescriptor*> fields;
68  self->parent->message->GetReflection()->ListFields(*self->parent->message,
69  &fields);
70 
71  for (size_t i = 0; i < fields.size(); ++i) {
72  if (fields[i]->is_extension()) {
73  // With C++ descriptors, the field can always be retrieved, but for
74  // unknown extensions which have not been imported in Python code, there
75  // is no message class and we cannot retrieve the value.
76  // ListFields() has the same behavior.
77  if (fields[i]->message_type() != nullptr &&
80  fields[i]->message_type()) == nullptr) {
81  PyErr_Clear();
82  continue;
83  }
84  ++size;
85  }
86  }
87  return size;
88 }
89 
90 struct ExtensionIterator {
92  Py_ssize_t index;
93  std::vector<const FieldDescriptor*> fields;
94 
95  // Owned reference, to keep the FieldDescriptors alive.
97 };
98 
99 PyObject* GetIter(PyObject* _self) {
100  ExtensionDict* self = reinterpret_cast<ExtensionDict*>(_self);
101 
102  ScopedPyObjectPtr obj(PyType_GenericAlloc(&ExtensionIterator_Type, 0));
103  if (obj == nullptr) {
104  return PyErr_Format(PyExc_MemoryError,
105  "Could not allocate extension iterator");
106  }
107 
108  ExtensionIterator* iter = reinterpret_cast<ExtensionIterator*>(obj.get());
109 
110  // Call "placement new" to initialize. So the constructor of
111  // std::vector<...> fields will be called.
112  new (iter) ExtensionIterator;
113 
114  self->parent->message->GetReflection()->ListFields(*self->parent->message,
115  &iter->fields);
116  iter->index = 0;
117  Py_INCREF(self);
118  iter->extension_dict = self;
119 
120  return obj.release();
121 }
122 
123 static void DeallocExtensionIterator(PyObject* _self) {
124  ExtensionIterator* self = reinterpret_cast<ExtensionIterator*>(_self);
125  self->fields.clear();
126  Py_XDECREF(self->extension_dict);
127  self->~ExtensionIterator();
128  Py_TYPE(_self)->tp_free(_self);
129 }
130 
131 PyObject* subscript(ExtensionDict* self, PyObject* key) {
133  if (descriptor == NULL) {
134  return NULL;
135  }
136  if (!CheckFieldBelongsToMessage(descriptor, self->parent->message)) {
137  return NULL;
138  }
139 
142  return cmessage::InternalGetScalar(self->parent->message, descriptor);
143  }
144 
146  self->parent->composite_fields->find(descriptor);
147  if (iterator != self->parent->composite_fields->end()) {
148  Py_INCREF(iterator->second);
149  return iterator->second->AsPyObject();
150  }
151 
154  // TODO(plabatut): consider building the class on the fly!
155  ContainerBase* sub_message = cmessage::InternalGetSubMessage(
156  self->parent, descriptor);
157  if (sub_message == NULL) {
158  return NULL;
159  }
160  (*self->parent->composite_fields)[descriptor] = sub_message;
161  return sub_message->AsPyObject();
162  }
163 
165  if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
166  // On the fly message class creation is needed to support the following
167  // situation:
168  // 1- add FileDescriptor to the pool that contains extensions of a message
169  // defined by another proto file. Do not create any message classes.
170  // 2- instantiate an extended message, and access the extension using
171  // the field descriptor.
172  // 3- the extension submessage fails to be returned, because no class has
173  // been created.
174  // It happens when deserializing text proto format, or when enumerating
175  // fields of a deserialized message.
176  CMessageClass* message_class = message_factory::GetOrCreateMessageClass(
178  descriptor->message_type());
179  ScopedPyObjectPtr message_class_handler(
180  reinterpret_cast<PyObject*>(message_class));
181  if (message_class == NULL) {
182  return NULL;
183  }
184  ContainerBase* py_container = repeated_composite_container::NewContainer(
185  self->parent, descriptor, message_class);
186  if (py_container == NULL) {
187  return NULL;
188  }
189  (*self->parent->composite_fields)[descriptor] = py_container;
190  return py_container->AsPyObject();
191  } else {
192  ContainerBase* py_container = repeated_scalar_container::NewContainer(
193  self->parent, descriptor);
194  if (py_container == NULL) {
195  return NULL;
196  }
197  (*self->parent->composite_fields)[descriptor] = py_container;
198  return py_container->AsPyObject();
199  }
200  }
201  PyErr_SetString(PyExc_ValueError, "control reached unexpected line");
202  return NULL;
203 }
204 
205 int ass_subscript(ExtensionDict* self, PyObject* key, PyObject* value) {
207  if (descriptor == NULL) {
208  return -1;
209  }
210  if (!CheckFieldBelongsToMessage(descriptor, self->parent->message)) {
211  return -1;
212  }
213 
214  if (value == nullptr) {
216  }
217 
220  PyErr_SetString(PyExc_TypeError, "Extension is repeated and/or composite "
221  "type");
222  return -1;
223  }
225  if (cmessage::InternalSetScalar(self->parent, descriptor, value) < 0) {
226  return -1;
227  }
228  return 0;
229 }
230 
231 PyObject* _FindExtensionByName(ExtensionDict* self, PyObject* arg) {
232  char* name;
233  Py_ssize_t name_size;
234  if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
235  return NULL;
236  }
237 
239  const FieldDescriptor* message_extension =
240  pool->pool->FindExtensionByName(StringParam(name, name_size));
241  if (message_extension == NULL) {
242  // Is is the name of a message set extension?
243  const Descriptor* message_descriptor =
244  pool->pool->FindMessageTypeByName(StringParam(name, name_size));
245  if (message_descriptor && message_descriptor->extension_count() > 0) {
246  const FieldDescriptor* extension = message_descriptor->extension(0);
247  if (extension->is_extension() &&
248  extension->containing_type()->options().message_set_wire_format() &&
251  message_extension = extension;
252  }
253  }
254  }
255  if (message_extension == NULL) {
256  Py_RETURN_NONE;
257  }
258 
259  return PyFieldDescriptor_FromDescriptor(message_extension);
260 }
261 
262 PyObject* _FindExtensionByNumber(ExtensionDict* self, PyObject* arg) {
263  int64_t number = PyLong_AsLong(arg);
264  if (number == -1 && PyErr_Occurred()) {
265  return NULL;
266  }
267 
269  const FieldDescriptor* message_extension = pool->pool->FindExtensionByNumber(
270  self->parent->message->GetDescriptor(), number);
271  if (message_extension == NULL) {
272  Py_RETURN_NONE;
273  }
274 
275  return PyFieldDescriptor_FromDescriptor(message_extension);
276 }
277 
278 static int Contains(PyObject* _self, PyObject* key) {
279  ExtensionDict* self = reinterpret_cast<ExtensionDict*>(_self);
280  const FieldDescriptor* field_descriptor =
282  if (field_descriptor == nullptr) {
283  return -1;
284  }
285 
286  if (!field_descriptor->is_extension()) {
287  PyErr_Format(PyExc_KeyError, "%s is not an extension",
288  field_descriptor->full_name().c_str());
289  return -1;
290  }
291 
292  const Message* message = self->parent->message;
293  const Reflection* reflection = message->GetReflection();
294  if (field_descriptor->is_repeated()) {
295  if (reflection->FieldSize(*message, field_descriptor) > 0) {
296  return 1;
297  }
298  } else {
299  if (reflection->HasField(*message, field_descriptor)) {
300  return 1;
301  }
302  }
303 
304  return 0;
305 }
306 
308  ExtensionDict* self = reinterpret_cast<ExtensionDict*>(
309  PyType_GenericAlloc(&ExtensionDict_Type, 0));
310  if (self == NULL) {
311  return NULL;
312  }
313 
314  Py_INCREF(parent);
315  self->parent = parent;
316  return self;
317 }
318 
319 void dealloc(PyObject* pself) {
320  ExtensionDict* self = reinterpret_cast<ExtensionDict*>(pself);
321  Py_CLEAR(self->parent);
322  Py_TYPE(self)->tp_free(reinterpret_cast<PyObject*>(self));
323 }
324 
325 static PyObject* RichCompare(ExtensionDict* self, PyObject* other, int opid) {
326  // Only equality comparisons are implemented.
327  if (opid != Py_EQ && opid != Py_NE) {
328  Py_INCREF(Py_NotImplemented);
329  return Py_NotImplemented;
330  }
331  bool equals = false;
332  if (PyObject_TypeCheck(other, &ExtensionDict_Type)) {
333  equals = self->parent == reinterpret_cast<ExtensionDict*>(other)->parent;;
334  }
335  if (equals ^ (opid == Py_EQ)) {
336  Py_RETURN_FALSE;
337  } else {
338  Py_RETURN_TRUE;
339  }
340 }
341 static PySequenceMethods SeqMethods = {
342  (lenfunc)len, // sq_length
343  0, // sq_concat
344  0, // sq_repeat
345  0, // sq_item
346  0, // sq_slice
347  0, // sq_ass_item
348  0, // sq_ass_slice
349  (objobjproc)Contains, // sq_contains
350 };
351 
352 static PyMappingMethods MpMethods = {
353  (lenfunc)len, /* mp_length */
354  (binaryfunc)subscript, /* mp_subscript */
355  (objobjargproc)ass_subscript,/* mp_ass_subscript */
356 };
357 
358 #define EDMETHOD(name, args, doc) { #name, (PyCFunction)name, args, doc }
359 static PyMethodDef Methods[] = {
360  EDMETHOD(_FindExtensionByName, METH_O, "Finds an extension by name."),
362  "Finds an extension by field number."),
363  {NULL, NULL},
364 };
365 
366 } // namespace extension_dict
367 
368 PyTypeObject ExtensionDict_Type = {
369  PyVarObject_HEAD_INIT(&PyType_Type, 0) //
370  FULL_MODULE_NAME ".ExtensionDict", // tp_name
371  sizeof(ExtensionDict), // tp_basicsize
372  0, // tp_itemsize
373  (destructor)extension_dict::dealloc, // tp_dealloc
374  0, // tp_print
375  0, // tp_getattr
376  0, // tp_setattr
377  0, // tp_compare
378  0, // tp_repr
379  0, // tp_as_number
380  &extension_dict::SeqMethods, // tp_as_sequence
381  &extension_dict::MpMethods, // tp_as_mapping
382  PyObject_HashNotImplemented, // tp_hash
383  0, // tp_call
384  0, // tp_str
385  0, // tp_getattro
386  0, // tp_setattro
387  0, // tp_as_buffer
388  Py_TPFLAGS_DEFAULT, // tp_flags
389  "An extension dict", // tp_doc
390  0, // tp_traverse
391  0, // tp_clear
392  (richcmpfunc)extension_dict::RichCompare, // tp_richcompare
393  0, // tp_weaklistoffset
394  extension_dict::GetIter, // tp_iter
395  0, // tp_iternext
396  extension_dict::Methods, // tp_methods
397  0, // tp_members
398  0, // tp_getset
399  0, // tp_base
400  0, // tp_dict
401  0, // tp_descr_get
402  0, // tp_descr_set
403  0, // tp_dictoffset
404  0, // tp_init
405 };
406 
407 PyObject* IterNext(PyObject* _self) {
408  extension_dict::ExtensionIterator* self =
409  reinterpret_cast<extension_dict::ExtensionIterator*>(_self);
410  Py_ssize_t total_size = self->fields.size();
411  Py_ssize_t index = self->index;
412  while (self->index < total_size) {
413  index = self->index;
414  ++self->index;
415  if (self->fields[index]->is_extension()) {
416  // With C++ descriptors, the field can always be retrieved, but for
417  // unknown extensions which have not been imported in Python code, there
418  // is no message class and we cannot retrieve the value.
419  // ListFields() has the same behavior.
420  if (self->fields[index]->message_type() != nullptr &&
422  cmessage::GetFactoryForMessage(self->extension_dict->parent),
423  self->fields[index]->message_type()) == nullptr) {
424  PyErr_Clear();
425  continue;
426  }
427 
429  }
430  }
431 
432  return nullptr;
433 }
434 
435 PyTypeObject ExtensionIterator_Type = {
436  PyVarObject_HEAD_INIT(&PyType_Type, 0) //
437  FULL_MODULE_NAME ".ExtensionIterator", // tp_name
438  sizeof(extension_dict::ExtensionIterator), // tp_basicsize
439  0, // tp_itemsize
440  extension_dict::DeallocExtensionIterator, // tp_dealloc
441  0, // tp_print
442  0, // tp_getattr
443  0, // tp_setattr
444  0, // tp_compare
445  0, // tp_repr
446  0, // tp_as_number
447  0, // tp_as_sequence
448  0, // tp_as_mapping
449  0, // tp_hash
450  0, // tp_call
451  0, // tp_str
452  0, // tp_getattro
453  0, // tp_setattro
454  0, // tp_as_buffer
455  Py_TPFLAGS_DEFAULT, // tp_flags
456  "A scalar map iterator", // tp_doc
457  0, // tp_traverse
458  0, // tp_clear
459  0, // tp_richcompare
460  0, // tp_weaklistoffset
461  PyObject_SelfIter, // tp_iter
462  IterNext, // tp_iternext
463  0, // tp_methods
464  0, // tp_members
465  0, // tp_getset
466  0, // tp_base
467  0, // tp_dict
468  0, // tp_descr_get
469  0, // tp_descr_set
470  0, // tp_dictoffset
471  0, // tp_init
472 };
473 } // namespace python
474 } // namespace protobuf
475 } // namespace google
google::protobuf::python::extension_dict::ExtensionIterator::PyObject_HEAD
PyObject_HEAD
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:94
obj
OPENSSL_EXPORT const ASN1_OBJECT * obj
Definition: x509.h:1671
google::protobuf::python::cmessage::GetExtensionDescriptor
const FieldDescriptor * GetExtensionDescriptor(PyObject *extension)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:934
google::protobuf::python::extension_dict::dealloc
void dealloc(PyObject *pself)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:322
google::protobuf::EnumValueDescriptor::type
const EnumDescriptor * type() const
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::EnumValueDescriptor::options
const EnumValueOptions & options() const
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
google::protobuf::python::extension_dict::_FindExtensionByName
PyObject * _FindExtensionByName(ExtensionDict *self, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:234
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2001
google::protobuf::FieldDescriptor::is_extension
bool is_extension() const
google::protobuf::FieldDescriptor::full_name
const std::string & full_name() const
google::protobuf::python::CMessage
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:100
scalar
Definition: spake25519.c:317
phone_pb2.message_type
message_type
Definition: phone_pb2.py:200
google::protobuf::python::ScopedPyObjectPtr
ScopedPythonPtr< PyObject > ScopedPyObjectPtr
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h:95
google::protobuf::python::extension_dict::len
static Py_ssize_t len(ExtensionDict *self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:68
google::protobuf::python::PyDescriptorPool
struct google::protobuf::python::PyDescriptorPool PyDescriptorPool
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
setup.name
name
Definition: setup.py:542
FULL_MODULE_NAME
#define FULL_MODULE_NAME
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:331
google::protobuf::python::cmessage::InternalGetScalar
PyObject * InternalGetScalar(const Message *message, const FieldDescriptor *field_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2181
google::protobuf::python::extension_dict::_FindExtensionByNumber
PyObject * _FindExtensionByNumber(ExtensionDict *self, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:265
google::protobuf::FieldDescriptor::LABEL_OPTIONAL
@ LABEL_OPTIONAL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:572
google::protobuf::Reflection
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:397
iterator
const typedef MCPhysReg * iterator
Definition: MCRegisterInfo.h:27
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:480
google::protobuf::python::extension_dict::GetIter
PyObject * GetIter(PyObject *_self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:102
google::protobuf::Reflection::HasField
bool HasField(const Message &message, const FieldDescriptor *field) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:728
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
google::protobuf::python::PyFieldDescriptor_FromDescriptor
PyObject * PyFieldDescriptor_FromDescriptor(const FieldDescriptor *field_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc:1037
testing::An
Matcher< T > An()
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:8555
google::protobuf::python::extension_dict::subscript
PyObject * subscript(ExtensionDict *self, PyObject *key)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:134
google::protobuf::python::extension_dict::RichCompare
static PyObject * RichCompare(ExtensionDict *self, PyObject *other, int opid)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:328
google::protobuf::python::IterNext
PyObject * IterNext(PyObject *_self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:410
google::protobuf::python::extension_dict::SeqMethods
static PySequenceMethods SeqMethods
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:344
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::python::GetIter
static MapIterator * GetIter(PyObject *obj)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/map_container.cc:907
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
google::protobuf::python::extension_dict::ExtensionIterator::fields
std::vector< const FieldDescriptor * > fields
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:96
google::protobuf::python::ExtensionIterator_Type
PyTypeObject ExtensionIterator_Type
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:438
google::protobuf::python::ExtensionDict
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.h:51
arg
Definition: cmdline.cc:40
number
int32_t number
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:850
google::protobuf::FieldDescriptor::LABEL_REPEATED
@ LABEL_REPEATED
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:574
google::protobuf::python::extension_dict::NewExtensionDict
ExtensionDict * NewExtensionDict(CMessage *parent)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:310
google::protobuf::python::ExtensionDict
struct google::protobuf::python::ExtensionDict ExtensionDict
google::protobuf::python::cmessage::ClearFieldByDescriptor
int ClearFieldByDescriptor(CMessage *self, const FieldDescriptor *field_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1602
google::protobuf::python::message_factory::GetOrCreateMessageClass
CMessageClass * GetOrCreateMessageClass(PyMessageFactory *self, const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message_factory.cc:155
google::protobuf::Reflection::FieldSize
int FieldSize(const Message &message, const FieldDescriptor *field) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:744
google::protobuf::python::extension_dict::DeallocExtensionIterator
static void DeallocExtensionIterator(PyObject *_self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:126
google::protobuf::python::cmessage::AssureWritable
int AssureWritable(CMessage *self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:898
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
key
const char * key
Definition: hpack_parser_table.cc:164
google::protobuf::python::cmessage::GetFactoryForMessage
PyMessageFactory * GetFactoryForMessage(CMessage *message)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:830
google::protobuf::python::extension_dict::ExtensionIterator::index
Py_ssize_t index
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:95
google::protobuf::python::CheckFieldBelongsToMessage
bool CheckFieldBelongsToMessage(const FieldDescriptor *field_descriptor, const Message *message)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:817
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
google::protobuf::python::cmessage::InternalSetScalar
int InternalSetScalar(CMessage *self, const FieldDescriptor *field_descriptor, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2356
profile_analyzer.fields
list fields
Definition: profile_analyzer.py:266
google::protobuf::python::PyMessageFactory::pool
PyDescriptorPool * pool
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message_factory.h:62
google::protobuf::python::StringParam
std::string StringParam
Definition: protobuf/python/google/protobuf/pyext/descriptor.h:46
A
Definition: miscompile_with_no_unique_address_test.cc:23
google::protobuf::python::extension_dict::MpMethods
static PyMappingMethods MpMethods
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:355
google::protobuf::FieldDescriptor::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:536
EDMETHOD
#define EDMETHOD(name, args, doc)
Definition: protobuf/python/google/protobuf/pyext/extension_dict.cc:358
google::protobuf::python::extension_dict::ExtensionIterator::extension_dict
ExtensionDict * extension_dict
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:99
PyString_AsStringAndSize
#define PyString_AsStringAndSize(ob, charpp, sizep)
Definition: protobuf/python/google/protobuf/pyext/extension_dict.cc:52
google::protobuf::python::extension_dict::Methods
static PyMethodDef Methods[]
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:362
google::protobuf::python::extension_dict::Contains
static int Contains(PyObject *_self, PyObject *key)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:281
pool
InternalDescriptorPool * pool
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
google::protobuf::python::ExtensionDict_Type
PyTypeObject ExtensionDict_Type
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:371
PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc:161
iter
Definition: test_winkernel.cpp:47
google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE
@ CPPTYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:563
google::protobuf::python::extension_dict::ass_subscript
int ass_subscript(ExtensionDict *self, PyObject *key, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:208
google::protobuf::python::extension_dict::ExtensionIterator
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc:93
Py_TYPE
#define Py_TYPE(ob)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc:164
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
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
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
google::protobuf::FieldDescriptor::is_repeated
bool is_repeated() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2067
google::protobuf::python::message_factory::GetMessageClass
CMessageClass * GetMessageClass(PyMessageFactory *self, const Descriptor *message_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message_factory.cc:223
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::python::cmessage::InternalGetSubMessage
CMessage * InternalGetSubMessage(CMessage *self, const FieldDescriptor *field_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2248
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::python::repeated_composite_container::NewContainer
RepeatedCompositeContainer * NewContainer(CMessage *parent, const FieldDescriptor *parent_field_descriptor, CMessageClass *child_message_class)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:471
google::protobuf::python::repeated_scalar_container::NewContainer
RepeatedScalarContainer * NewContainer(CMessage *parent, const FieldDescriptor *parent_field_descriptor)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc:670


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