File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -300,11 +300,12 @@ _PyDict_DebugMallocStats(FILE *out)
300300
301301static void free_keys_object (PyInterpreterState * interp , PyDictKeysObject * keys );
302302
303- /* We might consider modifying PyDictKeysObject so we could use
304- Py_INCREF() instead of dictkeys_incref() (and likewise with
305- Py_DECREF() and dictkeys_decref()). However, there doesn't
306- seem to be enough benefit (performance or otherwise) to justify
307- the change. */
303+ /* PyDictKeysObject has refcounts like PyObject does, so we have the
304+ following two functions to mirror what Py_INCREF() and Py_DECREF() do.
305+ (Keep in mind that PyDictKeysObject isn't actually a PyObject.)
306+ Likewise a PyDictKeysObject can be immortal (e.g. Py_EMPTY_KEYS),
307+ so we apply a naive version of what Py_INCREF() and Py_DECREF() do
308+ for immortal objects. */
308309
309310static inline void
310311dictkeys_incref (PyDictKeysObject * dk )
You can’t perform that action at this time.
0 commit comments