[issue23971] dict(list) and dict.fromkeys() doesn't account for 2/3 fill ratio
Serhiy Storchaka
report at bugs.python.org
Wed May 13 14:28:09 CEST 2015
Serhiy Storchaka added the comment:
- if (dictresize(mp, Py_SIZE(seq))) {
+ if (dictresize(mp, Py_SIZE(seq) / 2 * 3)) {
If Py_SIZE(seq) is 1, dictresize argument is 0.
Why not wryte the expression as Py_SIZE(seq) * 3 / 2? It never overflows, because Py_SIZE(seq) is the size of allocated array of pointers.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23971>
_______________________________________
More information about the Python-bugs-list
mailing list