[issue46085] OrderedDict iterator allocates di_result unnecessarily

Inada Naoki report at bugs.python.org
Wed Dec 15 23:09:09 EST 2021


Inada Naoki <songofacandy at gmail.com> added the comment:

Nice catch.

>     if ((kind & _odict_ITER_KEYS) && (kind &_odict_ITER_VALUES))

You can reduce one branch by

```
#define _odict_ITER_ITEMS (_odict_ITER_KEYS|_odict_ITER_VALUES)
...
     if (kind & _odict_ITER_ITEMS == _odict_ITER_ITEMS)
```

----------
nosy: +methane

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46085>
_______________________________________


More information about the Python-bugs-list mailing list