Lines Matching defs:dict

105 /* PyDict_MINSIZE is the starting size for any new dict.
129 class dict "PyDictObject *" "&PyDict_Type"
162 their own hash codes, and this fits in a dict of size 2**15, the last 15 bits
237 static PyObject* dict_iter(PyDictObject *dict);
467 /* Uncomment to check the dict content in _PyDict_CheckConsistency() */
800 new dict object. */
898 /* The dict was mutated, restart */
987 /* The dict was mutated, restart */
1001 /* Lookup a string in a (all unicode) dict keys.
1003 * or if the dict keys is not all strings.
1091 _PyDict_HasOnlyStringKeys(PyObject *dict)
1095 assert(PyDict_Check(dict));
1097 if (((PyDictObject *)dict)->ma_keys->dk_kind != DICT_KEYS_GENERAL)
1099 while (PyDict_Next(dict, &pos, &key, &value))
1161 when it is known that the key is not present in the dict.
1163 The dict must be combined. */
1577 /* There are no strict guarantee that returned dict can contain minused
1578 * items without resize. So we create medium size dict instead of very
1579 * large dict or MemoryError.
1616 PyObject *dict = dict_new_presized(length, unicode);
1617 if (dict == NULL) {
1627 if (PyDict_SetItem(dict, key, value) < 0) {
1628 Py_DECREF(dict);
1635 return dict;
1643 * (suppressed) occurred when comparing keys in the dict's internal probe
2092 /* Empty the dict... */
2182 * Iterate over a dict. Use like so:
2195 * mutates the dict. One exception: it is safe if the loop merely changes
2205 /* Internal version of dict.pop(). */
2207 _PyDict_Pop_KnownHash(PyObject *dict, PyObject *key, Py_hash_t hash, PyObject *deflt)
2213 assert(PyDict_Check(dict));
2214 mp = (PyDictObject *)dict;
2244 _PyDict_Pop(PyObject *dict, PyObject *key, PyObject *deflt)
2248 if (((PyDictObject *)dict)->ma_used == 0) {
2261 return _PyDict_Pop_KnownHash(dict, key, hash, deflt);
2264 /* Internal version of dict.from_keys(). It is subclass-friendly. */
2426 Note that repr may mutate the dict. */
2551 /* Durnit. The allocations caused the dict to resize.
2583 /* Durnit. The allocations caused the dict to resize.
2612 * could resize the dict. :-(
2628 /* Durnit. The allocations caused the dict to resize.
2653 dict.fromkeys
2668 /* Single-arg dict update; used by dict_update_common and operators. */
2709 /* Note: dict.update() uses the METH_VARARGS|METH_KEYWORDS calling convention.
2710 Using METH_FASTCALL|METH_KEYWORDS would make dict.update(**dict2) calls
2838 /* Since the target dict is empty, PyDict_GetItem()
2923 "dict mutated during update");
3026 /* The dict is empty; just return a new dict. */
3067 (2) 'mp' is not a split-dict; and
3073 case when a large dict is almost emptied with multiple del/pop
3234 dict.__contains__
3265 dict.get
3391 dict.setdefault
3422 dict.pop
3442 dict.popitem
3447 Raises KeyError if the dict is empty.
3459 * could empty the dict, so if we checked the size first and that
3463 * tuple away if the dict *is* empty isn't a significant
3638 "D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\n\
3689 /* Return 1 if `key` is in dict `op`, 0 if not, and -1 on error. */
3733 /* Hack to implement "key in dict" */
3757 // dict subclasses must implement the GC protocol
3789 return dict_update_common(self, args, kwds, "dict");
3797 if (!_PyArg_CheckPositional("dict", nargs, 0, 1)) {
3824 dict_iter(PyDictObject *dict)
3826 return dictiter_new(dict, &PyDictIterKey_Type);
3830 "dict() -> new empty dictionary\n"
3831 "dict(mapping) -> new dictionary initialized from a mapping object's\n"
3833 "dict(iterable) -> new dictionary initialized as if via:\n"
3837 "dict(**kwargs) -> new dictionary initialized with the name=value pairs\n"
3838 " in the keyword argument list. For example: dict(one=1, two=2)");
3842 "dict",
3959 dictiter_new(PyDictObject *dict, PyTypeObject *itertype)
3966 Py_INCREF(dict);
3967 di->di_dict = dict;
3968 di->di_used = dict->ma_used;
3969 di->len = dict->ma_used;
3973 if (dict->ma_values) {
3974 di->di_pos = dict->ma_used - 1;
3977 di->di_pos = dict->ma_keys->dk_nentries - 1;
4489 dict.__reversed__
4491 Return a reverse iterator over the dict keys.
4573 _PyDictView_New(PyObject *dict, PyTypeObject *type)
4576 if (dict == NULL) {
4580 if (!PyDict_Check(dict)) {
4583 "%s() requires a dict argument, not '%s'",
4584 type->tp_name, Py_TYPE(dict)->tp_name);
4590 Py_INCREF(dict);
4591 dv->dv_dict = (PyDictObject *)dict;
4767 // PySet_New() has fast path for the dict object.
4768 PyObject *dict = (PyObject *)((_PyDictViewObject *)self)->dv_dict;
4769 if (PyDict_CheckExact(dict)) {
4770 left = dict;
4808 /* Python interpreter swaps parameters when dict view
4825 /* if other is another dict view, and it is bigger than self,
5082 "Return a reverse iterator over the dict keys.");
5126 dictkeys_new(PyObject *dict, PyObject *Py_UNUSED(ignored))
5128 return _PyDictView_New(dict, &PyDictKeys_Type);
5188 "Return a reverse iterator over the dict items.");
5232 dictitems_new(PyObject *dict, PyObject *Py_UNUSED(ignored))
5234 return _PyDictView_New(dict, &PyDictItems_Type);
5271 "Return a reverse iterator over the dict values.");
5313 dictvalues_new(PyObject *dict, PyObject *Py_UNUSED(ignored))
5315 return _PyDictView_New(dict, &PyDictValues_Type);
5386 PyObject *dict;
5389 dict = new_dict_with_shared_keys(CACHED_KEYS(tp));
5392 dict = PyDict_New();
5394 if (dict == NULL) {
5398 *dictptr = dict;
5457 PyObject *dict = make_dict_from_instance_attributes(keys, values);
5458 if (dict == NULL) {
5462 *_PyObject_ManagedDictPointer(obj) = dict;
5464 return PyDict_DelItem(dict, name);
5467 return PyDict_SetItem(dict, name, value);
5531 PyObject *dict = *dictptr;
5532 if (dict == NULL) {
5535 return ((PyDictObject *)dict)->ma_used == 0;
5591 PyObject *dict;
5599 *dictptr = dict = make_dict_from_instance_attributes(CACHED_KEYS(tp), *values_ptr);
5600 if (dict != NULL) {
5605 *dictptr = dict = PyDict_New();
5608 dict = *dictptr;
5618 dict = *dictptr;
5619 if (dict == NULL) {
5623 *dictptr = dict = new_dict_with_shared_keys(CACHED_KEYS(tp));
5626 *dictptr = dict = PyDict_New();
5630 Py_XINCREF(dict);
5631 return dict;
5638 PyObject *dict;
5645 dict = *dictptr;
5646 if (dict == NULL) {
5648 dict = new_dict_with_shared_keys(cached);
5649 if (dict == NULL)
5651 *dictptr = dict;
5654 res = PyDict_DelItem(dict, key);
5657 res = PyDict_SetItem(dict, key, value);
5660 dict = *dictptr;
5661 if (dict == NULL) {
5662 dict = PyDict_New();
5663 if (dict == NULL)
5665 *dictptr = dict;
5668 res = PyDict_DelItem(dict, key);
5670 res = PyDict_SetItem(dict, key, value);
5673 ASSERT_CONSISTENT(dict);