Go to the documentation of this file.
47 if (PySlice_Check(
index)) {
53 *
i = PyNumber_AsSsize_t(
index, PyExc_IndexError);
55 if (*
i == -1 && PyErr_Occurred()) {
56 PyErr_SetString(PyExc_TypeError,
"list indices must be integers");
64 if (*
i < 0 ||
size <= *
i) {
65 PyErr_Format(PyExc_IndexError,
"list index out of range");
88 return self->field & 1;
93 return (PyObject*)(
self->field & ~(
uintptr_t)1);
118 Py_DECREF(
self->ptr.parent);
140 Py_DECREF(
self->arena);
144 Py_DECREF(
self->ptr.parent);
156 :
state->repeated_scalar_container_type;
204 (
void*)PyType_GenericAlloc(
Py_TYPE(_self), 0);
205 if (clone == NULL)
return NULL;
218 return (PyObject*)clone;
225 PyObject*
it = PyObject_GetIter(
value);
227 PyErr_SetString(PyExc_TypeError,
"Value must be iterable");
235 while ((e = PyIter_Next(
it))) {
248 if (PyErr_Occurred()) {
261 if (index < 0 || index >=
size) {
262 PyErr_Format(PyExc_IndexError,
"list index (%zd) out of range",
index);
272 if (!arr)
return PyList_New(0);
276 PyObject* list = PyList_New(
n);
277 for (
size_t i = 0;
i <
n;
i++) {
283 PyList_SetItem(list,
i, val);
290 if (!list)
return NULL;
291 assert(!PyErr_Occurred());
292 PyObject* repr = PyObject_Repr(list);
300 if (opid != Py_EQ && opid != Py_NE) {
301 Py_INCREF(Py_NotImplemented);
302 return Py_NotImplemented;
305 PyObject* list2 = _other;
306 PyObject* del = NULL;
307 if (PyObject_TypeCheck(_other, _self->ob_type)) {
310 PyObject*
ret = PyObject_RichCompare(list1, list2, opid);
327 PyObject* list = PyList_New(
count);
335 PyList_SetItem(list,
i, item);
346 PyErr_SetString(PyExc_TypeError,
"does not support assignment");
360 PySequence_Fast(
value,
"must assign iterable to extended slice");
361 PyObject* item = NULL;
364 Py_ssize_t seq_size = PySequence_Size(seq);
365 if (seq_size !=
count) {
373 PyErr_Format(PyExc_ValueError,
374 "attempt to assign sequence of %zd to extended slice "
382 item = PySequence_GetItem(seq,
i);
456 Py_ssize_t
index = -1;
457 if (!PyArg_ParseTuple(
args,
"|n", &
index))
return NULL;
463 if (!
ret)
return NULL;
471 Py_ssize_t match_index = -1;
473 for (Py_ssize_t
i = 0;
i <
n; ++
i) {
475 if (!
elem)
return NULL;
476 int eq = PyObject_RichCompareBool(
elem,
value, Py_EQ);
483 if (match_index == -1) {
484 PyErr_SetString(PyExc_ValueError,
"remove(x): x not in container");
498 Py_ssize_t
size = PyList_Size(list);
501 for (Py_ssize_t
i = 0;
i <
size; ++
i) {
502 PyObject*
obj = PyList_GetItem(list,
i);
520 PyObject* sort_func = PyDict_GetItemString(kwds,
"sort_function");
521 if (sort_func != NULL) {
524 if (PyDict_SetItemString(kwds,
"cmp", sort_func) == -1)
return NULL;
525 if (PyDict_DelItemString(kwds,
"sort_function") == -1)
return NULL;
529 PyObject*
ret = NULL;
530 PyObject* full_slice = NULL;
531 PyObject* list = NULL;
533 PyObject* res = NULL;
534 if ((full_slice = PySlice_New(NULL, NULL, NULL)) &&
536 (
m = PyObject_GetAttrString(list,
"sort")) &&
537 (res = PyObject_Call(
m,
args, kwds)) &&
543 Py_XDECREF(full_slice);
554 for (
size_t i = 0;
i <
half;
i++) {
555 size_t i2 =
n -
i - 1;
576 if (!arr)
return NULL;
590 if (!py_msg)
return NULL;
603 if (!py_msg)
return NULL;
620 if (!arr)
return NULL;
638 if (!
ret)
return NULL;
654 "Makes a deep copy of the class."},
656 METH_VARARGS | METH_KEYWORDS,
"Adds an object to the repeated container."},
658 "Appends a message to the end of the repeated container."},
660 "Inserts a message before the specified index."},
662 "Adds objects to the repeated container."},
664 "Removes an object from the repeated container and returns it."},
666 "Removes an object from the repeated container."},
668 METH_VARARGS | METH_KEYWORDS,
"Sorts the repeated container."},
670 "Reverses elements order of the repeated container."},
672 "Adds objects to the repeated container."},
685 {Py_tp_hash, PyObject_HashNotImplemented},
720 if (index < 0 || index >=
size) {
721 PyErr_Format(PyExc_IndexError,
"list index (%zd) out of range",
index);
737 "Makes a deep copy of the class."},
741 "Appends an object to the repeated container."},
743 "Appends objects to the repeated container."},
745 "Inserts an object at the specified position in the container."},
747 "Removes an object from the repeated container and returns it."},
749 "Removes an object from the repeated container."},
751 METH_VARARGS | METH_KEYWORDS,
"Sorts the repeated container."},
753 "Reverses elements order of the repeated container."},
755 "Merges a repeated container into the current container."},
770 {Py_tp_hash, PyObject_HashNotImplemented},
786 PyObject* collections = NULL;
787 PyObject* seq = NULL;
788 PyObject* ret1 = NULL;
789 PyObject* ret2 = NULL;
790 PyTypeObject* type1 =
state->repeated_scalar_container_type;
791 PyTypeObject* type2 =
state->repeated_composite_container_type;
793 bool ok = (collections = PyImport_ImportModule(
"collections.abc")) &&
794 (seq = PyObject_GetAttrString(collections,
"MutableSequence")) &&
795 (ret1 = PyObject_CallMethod(seq,
"register",
"O", type1)) &&
796 (ret2 = PyObject_CallMethod(seq,
"register",
"O", type2));
798 Py_XDECREF(collections);
808 state->repeated_composite_container_type =
810 state->repeated_scalar_container_type =
813 return state->repeated_composite_container_type &&
814 state->repeated_scalar_container_type &&
upb_Array * upb_Array_New(upb_Arena *a, upb_CType type)
static int PyUpb_RepeatedContainer_SetSubscript(PyUpb_RepeatedContainer *self, upb_Array *arr, const upb_FieldDef *f, Py_ssize_t idx, Py_ssize_t count, Py_ssize_t step, PyObject *value)
OPENSSL_EXPORT const ASN1_OBJECT * obj
void upb_Array_Delete(upb_Array *arr, size_t i, size_t count)
PyObject * PyUpb_CMessage_MergeFrom(PyObject *self, PyObject *arg)
static PyTypeObject * PyUpb_RepeatedContainer_GetClass(const upb_FieldDef *f)
static PyObject * PyUpb_RepeatedContainer_RichCompare(PyObject *_self, PyObject *_other, int opid)
bool upb_Array_Resize(upb_Array *arr, size_t size, upb_Arena *arena)
static PyObject * PyUpb_RepeatedContainer_MergeFrom(PyObject *_self, PyObject *args)
bool PyUpb_CMessage_Verify(PyObject *self)
static PyObject * PyUpb_RepeatedContainer_GetFieldDescriptor(PyUpb_RepeatedContainer *self)
PyObject * PyUpb_UpbToPy(upb_MessageValue val, const upb_FieldDef *f, PyObject *arena)
static PyObject * PyUpb_RepeatedCompositeContainer_Append(PyObject *_self, PyObject *value)
PyUpb_ModuleState * PyUpb_ModuleState_GetFromModule(PyObject *module)
static PyType_Spec PyUpb_RepeatedScalarContainer_Spec
static PyObject * PyUpb_RepeatedContainer_Item(PyObject *_self, Py_ssize_t index)
void PyUpb_CMessage_SetConcreteSubobj(PyObject *_self, const upb_FieldDef *f, upb_MessageValue subobj)
PyObject * PyUpb_RepeatedContainer_Extend(PyObject *_self, PyObject *value)
upb_MessageValue upb_Array_Get(const upb_Array *arr, size_t i)
static int PyUpb_RepeatedContainer_DeleteSubscript(upb_Array *arr, Py_ssize_t idx, Py_ssize_t count, Py_ssize_t step)
void upb_Array_Move(upb_Array *arr, size_t dst_idx, size_t src_idx, size_t count)
grpc_core::ScopedArenaPtr arena
upb_Message * upb_Message_New(const upb_MessageDef *m, upb_Arena *a)
bool PyUpb_Repeated_Init(PyObject *m)
static PyObject * PyUpb_RepeatedCompositeContainer_AppendNew(PyObject *_self)
bool upb_FieldDef_IsMap(const upb_FieldDef *f)
static void PyUpb_Dealloc(void *self)
void PyUpb_RepeatedContainer_Reify(PyObject *_self, upb_Array *arr)
static bool PyUpb_Repeated_RegisterAsSequence(PyUpb_ModuleState *state)
static PyMethodDef PyUpb_RepeatedScalarContainer_Methods[]
static PyType_Slot PyUpb_RepeatedScalarContainer_Slots[]
static PyObject * PyUpb_RepeatedScalarContainer_Append(PyObject *_self, PyObject *value)
PyTypeObject * PyUpb_AddClass(PyObject *m, PyType_Spec *spec)
static PyObject * PyUpb_RepeatedContainer_Sort(PyObject *pself, PyObject *args, PyObject *kwds)
static PyMethodDef PyUpb_RepeatedCompositeContainer_Methods[]
PyObject * PyUpb_FieldDescriptor_Get(const upb_FieldDef *field)
const upb_Message * msg_val
bool upb_Array_Append(upb_Array *arr, upb_MessageValue val, upb_Arena *arena)
_W64 unsigned int uintptr_t
upb_CType upb_FieldDef_CType(const upb_FieldDef *f)
PyObject * PyUpb_Forbidden_New(PyObject *cls, PyObject *args, PyObject *kwds)
void PyUpb_CMessage_CacheDelete(PyObject *_self, const upb_FieldDef *f)
PyObject * PyUpb_RepeatedContainer_ToList(PyObject *_self)
const upb_MessageDef * upb_FieldDef_MessageSubDef(const upb_FieldDef *f)
const upb_FieldDef * PyUpb_FieldDescriptor_GetDef(PyObject *_self)
static bool IndexToRange(PyObject *index, Py_ssize_t size, Py_ssize_t *i, Py_ssize_t *count, Py_ssize_t *step)
size_t upb_Array_Size(const upb_Array *arr)
static bool PyUpb_RepeatedContainer_Assign(PyObject *_self, PyObject *list)
PyObject * PyUpb_RepeatedContainer_NewStub(PyObject *parent, const upb_FieldDef *f, PyObject *arena)
void upb_Array_Set(upb_Array *arr, size_t i, upb_MessageValue val)
PyObject * PyUpb_RepeatedContainer_GetOrCreateWrapper(upb_Array *arr, const upb_FieldDef *f, PyObject *arena)
PyObject * PyUpb_ObjCache_Get(const void *key)
PyUpb_ModuleState * PyUpb_ModuleState_Get(void)
static PyObject * PyUpb_RepeatedContainer_Insert(PyObject *_self, PyObject *args)
upb_Arena * PyUpb_Arena_Get(PyObject *arena)
static PyType_Spec PyUpb_RepeatedCompositeContainer_Spec
PyObject * PyUpb_Arena_New(void)
#define PYUPB_MODULE_NAME
static upb_Array * PyUpb_RepeatedContainer_GetIfReified(PyUpb_RepeatedContainer *self)
PyObject * PyUpb_RepeatedContainer_DeepCopy(PyObject *_self, PyObject *value)
bool upb_FieldDef_IsRepeated(const upb_FieldDef *f)
void PyUpb_ObjCache_Add(const void *key, PyObject *py_obj)
UniquePtr< SSL_SESSION > ret
static PyObject * PyUpb_RepeatedContainer_Subscript(PyObject *_self, PyObject *key)
static const upb_FieldDef * PyUpb_RepeatedContainer_GetField(PyUpb_RepeatedContainer *self)
upb_Array * PyUpb_RepeatedContainer_EnsureReified(PyObject *_self)
PyObject * PyUpb_CMessage_Get(upb_Message *u_msg, const upb_MessageDef *m, PyObject *arena)
bool upb_FieldDef_IsSubMessage(const upb_FieldDef *f)
static PyObject * PyUpb_RepeatedContainer_Remove(PyObject *_self, PyObject *value)
union PyUpb_RepeatedContainer::@696 ptr
static PyType_Slot PyUpb_RepeatedCompositeContainer_Slots[]
static Py_ssize_t PyUpb_RepeatedContainer_Length(PyObject *self)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
static int PyUpb_RepeatedScalarContainer_AssignItem(PyObject *_self, Py_ssize_t index, PyObject *item)
int PyUpb_CMessage_InitAttributes(PyObject *_self, PyObject *args, PyObject *kwargs)
void PyUpb_ObjCache_Delete(const void *key)
bool upb_Array_Insert(upb_Array *arr, size_t i, size_t count, upb_Arena *arena)
upb_Message * PyUpb_CMessage_GetIfReified(PyObject *_self)
PyObject * PyUpb_RepeatedCompositeContainer_Add(PyObject *_self, PyObject *args, PyObject *kwargs)
static void PyUpb_RepeatedContainer_Dealloc(PyObject *_self)
static PyObject * PyUpb_RepeatedContainer_Pop(PyObject *_self, PyObject *args)
static PyObject * PyUpb_RepeatedContainer_Reverse(PyObject *_self)
static grpc_slice repeated(char c, size_t length)
static int PyUpb_RepeatedContainer_AssignSubscript(PyObject *_self, PyObject *key, PyObject *value)
static PyObject * PyUpb_RepeatedContainer_Repr(PyObject *_self)
static bool PyUpb_RepeatedContainer_IsStub(PyUpb_RepeatedContainer *self)
bool PyUpb_PyToUpb(PyObject *obj, const upb_FieldDef *f, upb_MessageValue *val, upb_Arena *arena)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:08