Stéphane Wirtel | cbb6484 | 2019-05-17 11:55:34 +0200 | [diff] [blame] | 1 | .. highlight:: c |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 2 | |
| 3 | .. _dictobjects: |
| 4 | |
| 5 | Dictionary Objects |
| 6 | ------------------ |
| 7 | |
| 8 | .. index:: object: dictionary |
| 9 | |
| 10 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 11 | .. c:type:: PyDictObject |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 12 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 13 | This subtype of :c:type:`PyObject` represents a Python dictionary object. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 14 | |
| 15 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 16 | .. c:var:: PyTypeObject PyDict_Type |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 17 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 18 | This instance of :c:type:`PyTypeObject` represents the Python dictionary |
Georg Brandl | 2aff335 | 2010-10-17 10:59:41 +0000 | [diff] [blame] | 19 | type. This is the same object as :class:`dict` in the Python layer. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 20 | |
| 21 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 22 | .. c:function:: int PyDict_Check(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 23 | |
| 24 | Return true if *p* is a dict object or an instance of a subtype of the dict |
| 25 | type. |
| 26 | |
| 27 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 28 | .. c:function:: int PyDict_CheckExact(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 29 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 30 | Return true if *p* is a dict object, but not an instance of a subtype of |
| 31 | the dict type. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 32 | |
| 33 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 34 | .. c:function:: PyObject* PyDict_New() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 35 | |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 36 | Return a new empty dictionary, or ``NULL`` on failure. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 37 | |
| 38 | |
Victor Stinner | 0db176f | 2012-04-16 00:16:30 +0200 | [diff] [blame] | 39 | .. c:function:: PyObject* PyDictProxy_New(PyObject *mapping) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 40 | |
Victor Stinner | 0db176f | 2012-04-16 00:16:30 +0200 | [diff] [blame] | 41 | Return a :class:`types.MappingProxyType` object for a mapping which |
| 42 | enforces read-only behavior. This is normally used to create a view to |
| 43 | prevent modification of the dictionary for non-dynamic class types. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 44 | |
| 45 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 46 | .. c:function:: void PyDict_Clear(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 47 | |
| 48 | Empty an existing dictionary of all key-value pairs. |
| 49 | |
| 50 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 51 | .. c:function:: int PyDict_Contains(PyObject *p, PyObject *key) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 52 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 53 | Determine if dictionary *p* contains *key*. If an item in *p* is matches |
| 54 | *key*, return ``1``, otherwise return ``0``. On error, return ``-1``. |
| 55 | This is equivalent to the Python expression ``key in p``. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 56 | |
| 57 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 58 | .. c:function:: PyObject* PyDict_Copy(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 59 | |
| 60 | Return a new dictionary that contains the same key-value pairs as *p*. |
| 61 | |
| 62 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 63 | .. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 64 | |
Joannah Nanjekye | e1e8000 | 2020-01-29 07:20:53 -0400 | [diff] [blame] | 65 | Insert *val* into the dictionary *p* with a key of *key*. *key* must be |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 66 | :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return |
Joannah Nanjekye | e1e8000 | 2020-01-29 07:20:53 -0400 | [diff] [blame] | 67 | ``0`` on success or ``-1`` on failure. This function *does not* steal a |
| 68 | reference to *val*. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 69 | |
| 70 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 71 | .. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 72 | |
Benjamin Peterson | 87d98bc | 2009-03-23 21:52:09 +0000 | [diff] [blame] | 73 | .. index:: single: PyUnicode_FromString() |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 74 | |
Joannah Nanjekye | e1e8000 | 2020-01-29 07:20:53 -0400 | [diff] [blame] | 75 | Insert *val* into the dictionary *p* using *key* as a key. *key* should |
Serhiy Storchaka | 84b8e92 | 2017-03-30 10:01:03 +0300 | [diff] [blame] | 76 | be a :c:type:`const char\*`. The key object is created using |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 77 | ``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on |
Joannah Nanjekye | e1e8000 | 2020-01-29 07:20:53 -0400 | [diff] [blame] | 78 | failure. This function *does not* steal a reference to *val*. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 79 | |
| 80 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 81 | .. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 82 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 83 | Remove the entry in dictionary *p* with key *key*. *key* must be hashable; |
| 84 | if it isn't, :exc:`TypeError` is raised. Return ``0`` on success or ``-1`` |
| 85 | on failure. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 86 | |
| 87 | |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 88 | .. c:function:: int PyDict_DelItemString(PyObject *p, const char *key) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 89 | |
| 90 | Remove the entry in dictionary *p* which has a key specified by the string |
| 91 | *key*. Return ``0`` on success or ``-1`` on failure. |
| 92 | |
| 93 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 94 | .. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 95 | |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 96 | Return the object from dictionary *p* which has a key *key*. Return ``NULL`` |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 97 | if the key *key* is not present, but *without* setting an exception. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 98 | |
Serhiy Storchaka | 3fcc1e0 | 2018-12-18 13:57:17 +0200 | [diff] [blame] | 99 | Note that exceptions which occur while calling :meth:`__hash__` and |
| 100 | :meth:`__eq__` methods will get suppressed. |
| 101 | To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. |
| 102 | |
Alexandre Vassalotti | c3e36af | 2008-06-01 04:16:28 +0000 | [diff] [blame] | 103 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 104 | .. c:function:: PyObject* PyDict_GetItemWithError(PyObject *p, PyObject *key) |
Alexandre Vassalotti | 787f307 | 2008-06-01 04:00:18 +0000 | [diff] [blame] | 105 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 106 | Variant of :c:func:`PyDict_GetItem` that does not suppress |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 107 | exceptions. Return ``NULL`` **with** an exception set if an exception |
| 108 | occurred. Return ``NULL`` **without** an exception set if the key |
Alexandre Vassalotti | 787f307 | 2008-06-01 04:00:18 +0000 | [diff] [blame] | 109 | wasn't present. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 110 | |
Alexandre Vassalotti | c3e36af | 2008-06-01 04:16:28 +0000 | [diff] [blame] | 111 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 112 | .. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 113 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 114 | This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a |
Serhiy Storchaka | 84b8e92 | 2017-03-30 10:01:03 +0300 | [diff] [blame] | 115 | :c:type:`const char\*`, rather than a :c:type:`PyObject\*`. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 116 | |
Serhiy Storchaka | 3fcc1e0 | 2018-12-18 13:57:17 +0200 | [diff] [blame] | 117 | Note that exceptions which occur while calling :meth:`__hash__` and |
| 118 | :meth:`__eq__` methods and creating a temporary string object |
| 119 | will get suppressed. |
| 120 | To get error reporting use :c:func:`PyDict_GetItemWithError()` instead. |
| 121 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 122 | |
Sergey Fedoseev | d90a141 | 2019-02-25 19:52:40 +0500 | [diff] [blame] | 123 | .. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *defaultobj) |
Benjamin Peterson | 00e9886 | 2013-03-07 22:16:29 -0500 | [diff] [blame] | 124 | |
Ezio Melotti | fc5c532 | 2013-03-10 20:57:16 +0200 | [diff] [blame] | 125 | This is the same as the Python-level :meth:`dict.setdefault`. If present, it |
Benjamin Peterson | 00e9886 | 2013-03-07 22:16:29 -0500 | [diff] [blame] | 126 | returns the value corresponding to *key* from the dictionary *p*. If the key |
Benjamin Peterson | 37474f4 | 2013-03-11 12:17:19 -0500 | [diff] [blame] | 127 | is not in the dict, it is inserted with value *defaultobj* and *defaultobj* |
| 128 | is returned. This function evaluates the hash function of *key* only once, |
Benjamin Peterson | 2855814 | 2013-03-11 11:50:21 -0500 | [diff] [blame] | 129 | instead of evaluating it independently for the lookup and the insertion. |
Benjamin Peterson | 00e9886 | 2013-03-07 22:16:29 -0500 | [diff] [blame] | 130 | |
Berker Peksag | e75ffa9 | 2016-07-05 17:08:29 +0300 | [diff] [blame] | 131 | .. versionadded:: 3.4 |
Benjamin Peterson | 00e9886 | 2013-03-07 22:16:29 -0500 | [diff] [blame] | 132 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 133 | .. c:function:: PyObject* PyDict_Items(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 134 | |
Benjamin Peterson | 3c6830c | 2010-11-03 21:35:28 +0000 | [diff] [blame] | 135 | Return a :c:type:`PyListObject` containing all the items from the dictionary. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 136 | |
| 137 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 138 | .. c:function:: PyObject* PyDict_Keys(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 139 | |
Benjamin Peterson | 3c6830c | 2010-11-03 21:35:28 +0000 | [diff] [blame] | 140 | Return a :c:type:`PyListObject` containing all the keys from the dictionary. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 141 | |
| 142 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 143 | .. c:function:: PyObject* PyDict_Values(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 144 | |
Benjamin Peterson | 3c6830c | 2010-11-03 21:35:28 +0000 | [diff] [blame] | 145 | Return a :c:type:`PyListObject` containing all the values from the dictionary |
| 146 | *p*. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 147 | |
| 148 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 149 | .. c:function:: Py_ssize_t PyDict_Size(PyObject *p) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 150 | |
| 151 | .. index:: builtin: len |
| 152 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 153 | Return the number of items in the dictionary. This is equivalent to |
| 154 | ``len(p)`` on a dictionary. |
| 155 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 156 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 157 | .. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 158 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 159 | Iterate over all key-value pairs in the dictionary *p*. The |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 160 | :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 161 | prior to the first call to this function to start the iteration; the |
| 162 | function returns true for each pair in the dictionary, and false once all |
| 163 | pairs have been reported. The parameters *pkey* and *pvalue* should either |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 164 | point to :c:type:`PyObject\*` variables that will be filled in with each key |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 165 | and value, respectively, or may be ``NULL``. Any references returned through |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 166 | them are borrowed. *ppos* should not be altered during iteration. Its |
| 167 | value represents offsets within the internal dictionary structure, and |
| 168 | since the structure is sparse, the offsets are not consecutive. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 169 | |
| 170 | For example:: |
| 171 | |
| 172 | PyObject *key, *value; |
| 173 | Py_ssize_t pos = 0; |
| 174 | |
| 175 | while (PyDict_Next(self->dict, &pos, &key, &value)) { |
| 176 | /* do something interesting with the values... */ |
| 177 | ... |
| 178 | } |
| 179 | |
Georg Brandl | e6bcc91 | 2008-05-12 18:05:20 +0000 | [diff] [blame] | 180 | The dictionary *p* should not be mutated during iteration. It is safe to |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 181 | modify the values of the keys as you iterate over the dictionary, but only |
| 182 | so long as the set of keys does not change. For example:: |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 183 | |
| 184 | PyObject *key, *value; |
| 185 | Py_ssize_t pos = 0; |
| 186 | |
| 187 | while (PyDict_Next(self->dict, &pos, &key, &value)) { |
| 188 | long i = PyLong_AsLong(value); |
| 189 | if (i == -1 && PyErr_Occurred()) { |
| 190 | return -1; |
| 191 | } |
| 192 | PyObject *o = PyLong_FromLong(i + 1); |
| 193 | if (o == NULL) |
| 194 | return -1; |
| 195 | if (PyDict_SetItem(self->dict, key, o) < 0) { |
| 196 | Py_DECREF(o); |
| 197 | return -1; |
| 198 | } |
| 199 | Py_DECREF(o); |
| 200 | } |
| 201 | |
| 202 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 203 | .. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 204 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 205 | Iterate over mapping object *b* adding key-value pairs to dictionary *a*. |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 206 | *b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` |
| 207 | and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a* |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 208 | will be replaced if a matching key is found in *b*, otherwise pairs will |
| 209 | only be added if there is not a matching key in *a*. Return ``0`` on |
| 210 | success or ``-1`` if an exception was raised. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 211 | |
| 212 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 213 | .. c:function:: int PyDict_Update(PyObject *a, PyObject *b) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 214 | |
Georg Brandl | 1c669c1 | 2014-03-25 09:34:30 +0100 | [diff] [blame] | 215 | This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to |
| 216 | ``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall |
| 217 | back to the iterating over a sequence of key value pairs if the second |
| 218 | argument has no "keys" attribute. Return ``0`` on success or ``-1`` if an |
| 219 | exception was raised. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 220 | |
| 221 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 222 | .. c:function:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 223 | |
Jeroen Ruigrok van der Werven | bd87552 | 2009-04-26 21:06:15 +0000 | [diff] [blame] | 224 | Update or merge into dictionary *a*, from the key-value pairs in *seq2*. |
| 225 | *seq2* must be an iterable object producing iterable objects of length 2, |
| 226 | viewed as key-value pairs. In case of duplicate keys, the last wins if |
| 227 | *override* is true, else the first wins. Return ``0`` on success or ``-1`` |
| 228 | if an exception was raised. Equivalent Python (except for the return |
| 229 | value):: |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 230 | |
| 231 | def PyDict_MergeFromSeq2(a, seq2, override): |
| 232 | for key, value in seq2: |
| 233 | if override or key not in a: |
| 234 | a[key] = value |
Antoine Pitrou | 9a812cb | 2011-11-15 00:00:12 +0100 | [diff] [blame] | 235 | |
| 236 | |
| 237 | .. c:function:: int PyDict_ClearFreeList() |
| 238 | |
| 239 | Clear the free list. Return the total number of freed items. |
| 240 | |
| 241 | .. versionadded:: 3.3 |