protobuf/python/google/protobuf/pyext/repeated_composite_container.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/repeated_composite_container.h>
35 
36 #include <memory>
37 
38 #include <google/protobuf/stubs/logging.h>
39 #include <google/protobuf/stubs/common.h>
40 #include <google/protobuf/descriptor.h>
41 #include <google/protobuf/dynamic_message.h>
42 #include <google/protobuf/message.h>
43 #include <google/protobuf/pyext/descriptor.h>
44 #include <google/protobuf/pyext/descriptor_pool.h>
45 #include <google/protobuf/pyext/message.h>
46 #include <google/protobuf/pyext/message_factory.h>
47 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
48 #include <google/protobuf/reflection.h>
49 #include <google/protobuf/stubs/map_util.h>
50 
51 namespace google {
52 namespace protobuf {
53 namespace python {
54 
55 namespace repeated_composite_container {
56 
57 // ---------------------------------------------------------------------
58 // len()
59 
60 static Py_ssize_t Length(PyObject* pself) {
62  reinterpret_cast<RepeatedCompositeContainer*>(pself);
63 
64  Message* message = self->parent->message;
65  return message->GetReflection()->FieldSize(*message,
66  self->parent_field_descriptor);
67 }
68 
69 // ---------------------------------------------------------------------
70 // add()
71 
72 PyObject* Add(RepeatedCompositeContainer* self, PyObject* args,
73  PyObject* kwargs) {
74  if (cmessage::AssureWritable(self->parent) == -1) return nullptr;
75  Message* message = self->parent->message;
76 
77  Message* sub_message =
78  message->GetReflection()->AddMessage(
79  message,
80  self->parent_field_descriptor,
81  self->child_message_class->py_message_factory->message_factory);
83  self->parent_field_descriptor, sub_message, self->child_message_class);
84 
85  if (cmessage::InitAttributes(cmsg, args, kwargs) < 0) {
86  message->GetReflection()->RemoveLast(
87  message, self->parent_field_descriptor);
88  Py_DECREF(cmsg);
89  return nullptr;
90  }
91 
92  return cmsg->AsPyObject();
93 }
94 
95 static PyObject* AddMethod(PyObject* self, PyObject* args, PyObject* kwargs) {
96  return Add(reinterpret_cast<RepeatedCompositeContainer*>(self), args, kwargs);
97 }
98 
99 // ---------------------------------------------------------------------
100 // append()
101 
102 static PyObject* AddMessage(RepeatedCompositeContainer* self, PyObject* value) {
104  PyObject* py_cmsg;
105  Message* message = self->parent->message;
106  const Reflection* reflection = message->GetReflection();
107  py_cmsg = Add(self, nullptr, nullptr);
108  if (py_cmsg == nullptr) return nullptr;
109  CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg);
110  if (ScopedPyObjectPtr(cmessage::MergeFrom(cmsg, value)) == nullptr) {
111  reflection->RemoveLast(
112  message, self->parent_field_descriptor);
113  Py_DECREF(cmsg);
114  return nullptr;
115  }
116  return py_cmsg;
117 }
118 
119 static PyObject* AppendMethod(PyObject* pself, PyObject* value) {
121  reinterpret_cast<RepeatedCompositeContainer*>(pself);
122  ScopedPyObjectPtr py_cmsg(AddMessage(self, value));
123  if (py_cmsg == nullptr) {
124  return nullptr;
125  }
126 
127  Py_RETURN_NONE;
128 }
129 
130 // ---------------------------------------------------------------------
131 // insert()
132 static PyObject* Insert(PyObject* pself, PyObject* args) {
134  reinterpret_cast<RepeatedCompositeContainer*>(pself);
135 
136  Py_ssize_t index;
137  PyObject* value;
138  if (!PyArg_ParseTuple(args, "nO", &index, &value)) {
139  return nullptr;
140  }
141 
142  ScopedPyObjectPtr py_cmsg(AddMessage(self, value));
143  if (py_cmsg == nullptr) {
144  return nullptr;
145  }
146 
147  // Swap the element to right position.
148  Message* message = self->parent->message;
149  const Reflection* reflection = message->GetReflection();
150  const FieldDescriptor* field_descriptor = self->parent_field_descriptor;
151  Py_ssize_t length = reflection->FieldSize(*message, field_descriptor) - 1;
152  Py_ssize_t end_index = index;
153  if (end_index < 0) end_index += length;
154  if (end_index < 0) end_index = 0;
155  for (Py_ssize_t i = length; i > end_index; i --) {
156  reflection->SwapElements(message, field_descriptor, i, i - 1);
157  }
158 
159  Py_RETURN_NONE;
160 }
161 
162 // ---------------------------------------------------------------------
163 // extend()
164 
165 PyObject* Extend(RepeatedCompositeContainer* self, PyObject* value) {
167  ScopedPyObjectPtr iter(PyObject_GetIter(value));
168  if (iter == nullptr) {
169  PyErr_SetString(PyExc_TypeError, "Value must be iterable");
170  return nullptr;
171  }
173  while ((next.reset(PyIter_Next(iter.get()))) != nullptr) {
174  if (!PyObject_TypeCheck(next.get(), CMessage_Type)) {
175  PyErr_SetString(PyExc_TypeError, "Not a cmessage");
176  return nullptr;
177  }
178  ScopedPyObjectPtr new_message(Add(self, nullptr, nullptr));
179  if (new_message == nullptr) {
180  return nullptr;
181  }
182  CMessage* new_cmessage = reinterpret_cast<CMessage*>(new_message.get());
183  if (ScopedPyObjectPtr(cmessage::MergeFrom(new_cmessage, next.get())) ==
184  nullptr) {
185  return nullptr;
186  }
187  }
188  if (PyErr_Occurred()) {
189  return nullptr;
190  }
191  Py_RETURN_NONE;
192 }
193 
194 static PyObject* ExtendMethod(PyObject* self, PyObject* value) {
195  return Extend(reinterpret_cast<RepeatedCompositeContainer*>(self), value);
196 }
197 
198 PyObject* MergeFrom(RepeatedCompositeContainer* self, PyObject* other) {
199  return Extend(self, other);
200 }
201 
202 static PyObject* MergeFromMethod(PyObject* self, PyObject* other) {
203  return MergeFrom(reinterpret_cast<RepeatedCompositeContainer*>(self), other);
204 }
205 
206 // This function does not check the bounds.
207 static PyObject* GetItem(RepeatedCompositeContainer* self, Py_ssize_t index,
208  Py_ssize_t length = -1) {
209  if (length == -1) {
210  Message* message = self->parent->message;
211  const Reflection* reflection = message->GetReflection();
212  length = reflection->FieldSize(*message, self->parent_field_descriptor);
213  }
214  if (index < 0 || index >= length) {
215  PyErr_Format(PyExc_IndexError, "list index (%zd) out of range", index);
216  return nullptr;
217  }
218  Message* message = self->parent->message;
219  Message* sub_message = message->GetReflection()->MutableRepeatedMessage(
220  message, self->parent_field_descriptor, index);
221  return self->parent
222  ->BuildSubMessageFromPointer(self->parent_field_descriptor, sub_message,
223  self->child_message_class)
224  ->AsPyObject();
225 }
226 
227 PyObject* Subscript(RepeatedCompositeContainer* self, PyObject* item) {
228  Message* message = self->parent->message;
229  const Reflection* reflection = message->GetReflection();
230  Py_ssize_t length =
231  reflection->FieldSize(*message, self->parent_field_descriptor);
232 
233  if (PyIndex_Check(item)) {
234  Py_ssize_t index;
235  index = PyNumber_AsSsize_t(item, PyExc_IndexError);
236  if (index == -1 && PyErr_Occurred()) return nullptr;
237  if (index < 0) index += length;
238  return GetItem(self, index, length);
239  } else if (PySlice_Check(item)) {
240  Py_ssize_t from, to, step, slicelength, cur, i;
241  PyObject* result;
242 
243  if (PySlice_GetIndicesEx(item, length, &from, &to, &step, &slicelength) ==
244  -1) {
245  return nullptr;
246  }
247 
248  if (slicelength <= 0) {
249  return PyList_New(0);
250  } else {
251  result = PyList_New(slicelength);
252  if (!result) return nullptr;
253 
254  for (cur = from, i = 0; i < slicelength; cur += step, i++) {
255  PyList_SET_ITEM(result, i, GetItem(self, cur, length));
256  }
257 
258  return result;
259  }
260  } else {
261  PyErr_Format(PyExc_TypeError, "indices must be integers, not %.200s",
262  item->ob_type->tp_name);
263  return nullptr;
264  }
265 }
266 
267 static PyObject* SubscriptMethod(PyObject* self, PyObject* slice) {
268  return Subscript(reinterpret_cast<RepeatedCompositeContainer*>(self), slice);
269 }
270 
272  PyObject* slice,
273  PyObject* value) {
274  if (value != nullptr) {
275  PyErr_SetString(PyExc_TypeError, "does not support assignment");
276  return -1;
277  }
278 
279  return cmessage::DeleteRepeatedField(self->parent,
280  self->parent_field_descriptor, slice);
281 }
282 
283 static int AssignSubscriptMethod(PyObject* self, PyObject* slice,
284  PyObject* value) {
285  return AssignSubscript(reinterpret_cast<RepeatedCompositeContainer*>(self),
286  slice, value);
287 }
288 
289 static PyObject* Remove(PyObject* pself, PyObject* value) {
291  reinterpret_cast<RepeatedCompositeContainer*>(pself);
292  Py_ssize_t len = Length(reinterpret_cast<PyObject*>(self));
293 
294  for (Py_ssize_t i = 0; i < len; i++) {
295  ScopedPyObjectPtr item(GetItem(self, i, len));
296  if (item == nullptr) {
297  return nullptr;
298  }
299  int result = PyObject_RichCompareBool(item.get(), value, Py_EQ);
300  if (result < 0) {
301  return nullptr;
302  }
303  if (result) {
304  ScopedPyObjectPtr py_index(PyLong_FromSsize_t(i));
305  if (AssignSubscript(self, py_index.get(), nullptr) < 0) {
306  return nullptr;
307  }
308  Py_RETURN_NONE;
309  }
310  }
311  PyErr_SetString(PyExc_ValueError, "Item to delete not in list");
312  return nullptr;
313 }
314 
315 static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
317  reinterpret_cast<RepeatedCompositeContainer*>(pself);
318 
319  if (!PyObject_TypeCheck(other, &RepeatedCompositeContainer_Type)) {
320  PyErr_SetString(PyExc_TypeError,
321  "Can only compare repeated composite fields "
322  "against other repeated composite fields.");
323  return nullptr;
324  }
325  if (opid == Py_EQ || opid == Py_NE) {
326  // TODO(anuraag): Don't make new lists just for this...
327  ScopedPyObjectPtr full_slice(PySlice_New(nullptr, nullptr, nullptr));
328  if (full_slice == nullptr) {
329  return nullptr;
330  }
331  ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
332  if (list == nullptr) {
333  return nullptr;
334  }
335  ScopedPyObjectPtr other_list(
336  Subscript(reinterpret_cast<RepeatedCompositeContainer*>(other),
337  full_slice.get()));
338  if (other_list == nullptr) {
339  return nullptr;
340  }
341  return PyObject_RichCompare(list.get(), other_list.get(), opid);
342  } else {
343  Py_INCREF(Py_NotImplemented);
344  return Py_NotImplemented;
345  }
346 }
347 
348 static PyObject* ToStr(PyObject* pself) {
349  ScopedPyObjectPtr full_slice(PySlice_New(nullptr, nullptr, nullptr));
350  if (full_slice == nullptr) {
351  return nullptr;
352  }
354  reinterpret_cast<RepeatedCompositeContainer*>(pself), full_slice.get()));
355  if (list == nullptr) {
356  return nullptr;
357  }
358  return PyObject_Repr(list.get());
359 }
360 
361 // ---------------------------------------------------------------------
362 // sort()
363 
365  PyObject* child_list) {
366  Message* message = self->parent->message;
367  const Reflection* reflection = message->GetReflection();
368  const FieldDescriptor* descriptor = self->parent_field_descriptor;
369  const Py_ssize_t length = Length(reinterpret_cast<PyObject*>(self));
370 
371  // We need to rearrange things to match python's sort order. Because there
372  // was already an O(n*log(n)) step in python and a bunch of reflection, we
373  // expect an O(n**2) step in C++ won't hurt too much.
374  for (Py_ssize_t i = 0; i < length; ++i) {
375  Message* child_message =
376  reinterpret_cast<CMessage*>(PyList_GET_ITEM(child_list, i))->message;
377  for (Py_ssize_t j = i; j < length; ++j) {
378  if (child_message ==
379  &reflection->GetRepeatedMessage(*message, descriptor, j)) {
380  reflection->SwapElements(message, descriptor, i, j);
381  break;
382  }
383  }
384  }
385 }
386 
387 // Returns 0 if successful; returns -1 and sets an exception if
388 // unsuccessful.
390  PyObject* args,
391  PyObject* kwds) {
392  ScopedPyObjectPtr child_list(
393  PySequence_List(reinterpret_cast<PyObject*>(self)));
394  if (child_list == nullptr) {
395  return -1;
396  }
397  ScopedPyObjectPtr m(PyObject_GetAttrString(child_list.get(), "sort"));
398  if (m == nullptr) return -1;
399  if (ScopedPyObjectPtr(PyObject_Call(m.get(), args, kwds)) == nullptr)
400  return -1;
401  ReorderAttached(self, child_list.get());
402  return 0;
403 }
404 
405 static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
407  reinterpret_cast<RepeatedCompositeContainer*>(pself);
408 
409  // Support the old sort_function argument for backwards
410  // compatibility.
411  if (kwds != nullptr) {
412  PyObject* sort_func = PyDict_GetItemString(kwds, "sort_function");
413  if (sort_func != nullptr) {
414  // Must set before deleting as sort_func is a borrowed reference
415  // and kwds might be the only thing keeping it alive.
416  PyDict_SetItemString(kwds, "cmp", sort_func);
417  PyDict_DelItemString(kwds, "sort_function");
418  }
419  }
420 
421  if (SortPythonMessages(self, args, kwds) < 0) {
422  return nullptr;
423  }
424  Py_RETURN_NONE;
425 }
426 
427 // ---------------------------------------------------------------------
428 // reverse()
429 
430 // Returns 0 if successful; returns -1 and sets an exception if
431 // unsuccessful.
433  ScopedPyObjectPtr child_list(
434  PySequence_List(reinterpret_cast<PyObject*>(self)));
435  if (child_list == nullptr) {
436  return -1;
437  }
438  if (ScopedPyObjectPtr(
439  PyObject_CallMethod(child_list.get(), "reverse", nullptr)) == nullptr)
440  return -1;
441  ReorderAttached(self, child_list.get());
442  return 0;
443 }
444 
445 static PyObject* Reverse(PyObject* pself) {
447  reinterpret_cast<RepeatedCompositeContainer*>(pself);
448 
449  if (ReversePythonMessages(self) < 0) {
450  return nullptr;
451  }
452  Py_RETURN_NONE;
453 }
454 
455 // ---------------------------------------------------------------------
456 
457 static PyObject* Item(PyObject* pself, Py_ssize_t index) {
459  reinterpret_cast<RepeatedCompositeContainer*>(pself);
460  return GetItem(self, index);
461 }
462 
463 static PyObject* Pop(PyObject* pself, PyObject* args) {
465  reinterpret_cast<RepeatedCompositeContainer*>(pself);
466 
467  Py_ssize_t index = -1;
468  if (!PyArg_ParseTuple(args, "|n", &index)) {
469  return nullptr;
470  }
471  Py_ssize_t length = Length(pself);
472  if (index < 0) index += length;
473  PyObject* item = GetItem(self, index, length);
474  if (item == nullptr) {
475  return nullptr;
476  }
477  ScopedPyObjectPtr py_index(PyLong_FromSsize_t(index));
478  if (AssignSubscript(self, py_index.get(), nullptr) < 0) {
479  return nullptr;
480  }
481  return item;
482 }
483 
484 PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
485  return reinterpret_cast<RepeatedCompositeContainer*>(pself)->DeepCopy();
486 }
487 
488 // The private constructor of RepeatedCompositeContainer objects.
490  CMessage* parent,
491  const FieldDescriptor* parent_field_descriptor,
492  CMessageClass* child_message_class) {
493  if (!CheckFieldBelongsToMessage(parent_field_descriptor, parent->message)) {
494  return nullptr;
495  }
496 
498  reinterpret_cast<RepeatedCompositeContainer*>(
499  PyType_GenericAlloc(&RepeatedCompositeContainer_Type, 0));
500  if (self == nullptr) {
501  return nullptr;
502  }
503 
504  Py_INCREF(parent);
505  self->parent = parent;
506  self->parent_field_descriptor = parent_field_descriptor;
507  Py_INCREF(child_message_class);
508  self->child_message_class = child_message_class;
509  return self;
510 }
511 
512 static void Dealloc(PyObject* pself) {
514  reinterpret_cast<RepeatedCompositeContainer*>(pself);
515  self->RemoveFromParentCache();
516  Py_CLEAR(self->child_message_class);
517  Py_TYPE(self)->tp_free(pself);
518 }
519 
520 static PySequenceMethods SqMethods = {
521  Length, /* sq_length */
522  nullptr, /* sq_concat */
523  nullptr, /* sq_repeat */
524  Item /* sq_item */
525 };
526 
527 static PyMappingMethods MpMethods = {
528  Length, /* mp_length */
529  SubscriptMethod, /* mp_subscript */
530  AssignSubscriptMethod, /* mp_ass_subscript */
531 };
532 
533 static PyMethodDef Methods[] = {
534  {"__deepcopy__", DeepCopy, METH_VARARGS, "Makes a deep copy of the class."},
535  {"add", reinterpret_cast<PyCFunction>(AddMethod),
536  METH_VARARGS | METH_KEYWORDS, "Adds an object to the repeated container."},
537  {"append", AppendMethod, METH_O,
538  "Appends a message to the end of the repeated container."},
539  {"insert", Insert, METH_VARARGS,
540  "Inserts a message before the specified index."},
541  {"extend", ExtendMethod, METH_O, "Adds objects to the repeated container."},
542  {"pop", Pop, METH_VARARGS,
543  "Removes an object from the repeated container and returns it."},
544  {"remove", Remove, METH_O,
545  "Removes an object from the repeated container."},
546  {"sort", reinterpret_cast<PyCFunction>(Sort), METH_VARARGS | METH_KEYWORDS,
547  "Sorts the repeated container."},
548  {"reverse", reinterpret_cast<PyCFunction>(Reverse), METH_NOARGS,
549  "Reverses elements order of the repeated container."},
550  {"MergeFrom", MergeFromMethod, METH_O,
551  "Adds objects to the repeated container."},
552  {nullptr, nullptr}};
553 
554 } // namespace repeated_composite_container
555 
556 PyTypeObject RepeatedCompositeContainer_Type = {
557  PyVarObject_HEAD_INIT(&PyType_Type, 0) FULL_MODULE_NAME
558  ".RepeatedCompositeContainer", // tp_name
559  sizeof(RepeatedCompositeContainer), // tp_basicsize
560  0, // tp_itemsize
561  repeated_composite_container::Dealloc, // tp_dealloc
562 #if PY_VERSION_HEX >= 0x03080000
563  0, // tp_vectorcall_offset
564 #else
565  nullptr, // tp_print
566 #endif
567  nullptr, // tp_getattr
568  nullptr, // tp_setattr
569  nullptr, // tp_compare
571  nullptr, // tp_as_number
572  &repeated_composite_container::SqMethods, // tp_as_sequence
573  &repeated_composite_container::MpMethods, // tp_as_mapping
574  PyObject_HashNotImplemented, // tp_hash
575  nullptr, // tp_call
576  nullptr, // tp_str
577  nullptr, // tp_getattro
578  nullptr, // tp_setattro
579  nullptr, // tp_as_buffer
580  Py_TPFLAGS_DEFAULT, // tp_flags
581  "A Repeated scalar container", // tp_doc
582  nullptr, // tp_traverse
583  nullptr, // tp_clear
585  0, // tp_weaklistoffset
586  nullptr, // tp_iter
587  nullptr, // tp_iternext
589  nullptr, // tp_members
590  nullptr, // tp_getset
591  nullptr, // tp_base
592  nullptr, // tp_dict
593  nullptr, // tp_descr_get
594  nullptr, // tp_descr_set
595  0, // tp_dictoffset
596  nullptr, // tp_init
597 };
598 
599 } // namespace python
600 } // namespace protobuf
601 } // namespace google
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf::python::repeated_composite_container::Sort
static PyObject * Sort(PyObject *pself, PyObject *args, PyObject *kwds)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:415
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
google::protobuf::python::cmessage::InitAttributes
int InitAttributes(CMessage *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1066
google::protobuf::python::repeated_composite_container::Remove
static PyObject * Remove(PyObject *pself, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:301
google::protobuf::python::repeated_composite_container::GetItem
static PyObject * GetItem(RepeatedCompositeContainer *self, Py_ssize_t index, Py_ssize_t length=-1)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:214
google::protobuf::python::CMessage
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:100
google::protobuf::python::ScopedPythonPtr::get
PyObjectStruct * get() const
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h:76
google::protobuf::python::ScopedPyObjectPtr
ScopedPythonPtr< PyObject > ScopedPyObjectPtr
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h:95
google::protobuf::python::cmessage::MergeFrom
PyObject * MergeFrom(CMessage *self, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1829
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
FULL_MODULE_NAME
#define FULL_MODULE_NAME
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:331
to
size_t to
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1385
google::protobuf::python::ScopedPythonPtr
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h:46
google::protobuf::Reflection
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:397
google::protobuf::python::repeated_composite_container::DeepCopy
PyObject * DeepCopy(PyObject *pself, PyObject *arg)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:466
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf::python::repeated_composite_container::MpMethods
static PyMappingMethods MpMethods
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:509
from
size_t from
Definition: abseil-cpp/absl/container/internal/layout_test.cc:1384
google::protobuf::python::repeated_composite_container::AddMessage
static PyObject * AddMessage(RepeatedCompositeContainer *self, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:109
google::protobuf::python::repeated_composite_container::Length
static Py_ssize_t Length(PyObject *pself)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:66
google::protobuf::python::repeated_composite_container::Add
PyObject * Add(RepeatedCompositeContainer *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:78
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
google::protobuf::python::repeated_composite_container::Methods
static PyMethodDef Methods[]
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:515
google::protobuf::python::repeated_composite_container::AssignSubscript
int AssignSubscript(RepeatedCompositeContainer *self, PyObject *slice, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:283
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
google::protobuf::python::repeated_composite_container::Item
static PyObject * Item(PyObject *pself, Py_ssize_t index)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:439
google::protobuf::python::repeated_composite_container::Pop
static PyObject * Pop(PyObject *pself, PyObject *args)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:445
google::protobuf::python::CMessage_Type
PyTypeObject * CMessage_Type
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2847
google::protobuf::python::repeated_composite_container::SubscriptMethod
static PyObject * SubscriptMethod(PyObject *self, PyObject *slice)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:279
arg
Definition: cmdline.cc:40
google::protobuf::python::repeated_composite_container::Subscript
PyObject * Subscript(RepeatedCompositeContainer *self, PyObject *item)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:234
google::protobuf::python::repeated_composite_container::RichCompare
static PyObject * RichCompare(PyObject *pself, PyObject *other, int opid)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:327
google::protobuf::python::repeated_composite_container::AssignSubscriptMethod
static int AssignSubscriptMethod(PyObject *self, PyObject *slice, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:295
google::protobuf::Reflection::SwapElements
void SwapElements(Message *message, const FieldDescriptor *field, int index1, int index2) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:969
google::protobuf::Reflection::RemoveLast
void RemoveLast(Message *message, const FieldDescriptor *field) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:902
google::protobuf::python::ContainerBase::AsPyObject
PyObject * AsPyObject()
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:90
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::ContainerBase::RemoveFromParentCache
void RemoveFromParentCache()
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2754
google::protobuf::python::cmessage::AssureWritable
int AssureWritable(CMessage *self)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:898
google::protobuf::python::repeated_composite_container::AppendMethod
static PyObject * AppendMethod(PyObject *pself, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:126
memory_diff.cur
def cur
Definition: memory_diff.py:83
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
google::protobuf::python::CMessage
google::protobuf::python::CMessage CMessage
google::protobuf::python::repeated_composite_container::SqMethods
static PySequenceMethods SqMethods
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:502
google::protobuf::python::repeated_composite_container::ReversePythonMessages
static int ReversePythonMessages(RepeatedCompositeContainer *self)
Definition: protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:432
google::protobuf::python::repeated_composite_container::ReorderAttached
static void ReorderAttached(RepeatedCompositeContainer *self, PyObject *child_list)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:376
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::DeleteRepeatedField
int DeleteRepeatedField(CMessage *self, const FieldDescriptor *field_descriptor, PyObject *slice)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:977
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
step
static int step
Definition: test-mutexes.c:31
google::protobuf::python::repeated_composite_container::MergeFrom
PyObject * MergeFrom(RepeatedCompositeContainer *self, PyObject *other)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:205
google::protobuf::python::CMessage::BuildSubMessageFromPointer
CMessage * BuildSubMessageFromPointer(const FieldDescriptor *field_descriptor, Message *sub_message, CMessageClass *message_class)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:2763
google::protobuf::python::ContainerBase::parent
struct CMessage * parent
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.h:82
google::protobuf::python::repeated_composite_container::Reverse
static PyObject * Reverse(PyObject *pself)
Definition: protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:445
PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc:161
google::protobuf::python::RepeatedCompositeContainer_Type
PyTypeObject RepeatedCompositeContainer_Type
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:539
google::protobuf::python::repeated_composite_container::Dealloc
static void Dealloc(PyObject *pself)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:494
iter
Definition: test_winkernel.cpp:47
google::protobuf::python::repeated_composite_container::ToStr
static PyObject * ToStr(PyObject *pself)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:360
Py_TYPE
#define Py_TYPE(ob)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc:164
google::protobuf::python::repeated_composite_container::Insert
static PyObject * Insert(PyObject *pself, PyObject *args)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:139
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
google::protobuf::python::repeated_composite_container::AddMethod
static PyObject * AddMethod(PyObject *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:102
google::protobuf::python::RepeatedCompositeContainer
google::protobuf::python::RepeatedCompositeContainer RepeatedCompositeContainer
google::protobuf::python::repeated_composite_container::ExtendMethod
static PyObject * ExtendMethod(PyObject *self, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:201
length
std::size_t length
Definition: abseil-cpp/absl/time/internal/test_util.cc:57
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
regress.m
m
Definition: regress/regress.py:25
google::protobuf::python::repeated_composite_container::Extend
PyObject * Extend(RepeatedCompositeContainer *self, PyObject *value)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:172
google::protobuf::python::RepeatedCompositeContainer
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.h:57
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::Reflection::GetRepeatedMessage
const Message & GetRepeatedMessage(const Message &message, const FieldDescriptor *field, int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc:1596
google::protobuf::python::repeated_composite_container::MergeFromMethod
static PyObject * MergeFromMethod(PyObject *self, PyObject *other)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:209
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_composite_container::SortPythonMessages
static int SortPythonMessages(RepeatedCompositeContainer *self, PyObject *args, PyObject *kwds)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc:398


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:02