[New-bugs-announce] [issue16345] dict.fromkeys() assumes 'self' is empty

Armin Rigo report at bugs.python.org
Sun Oct 28 09:04:26 CET 2012


New submission from Armin Rigo:

The implementation of dict.fromkeys() assumes that the new dictionary is empty.  That's not the case if we tweak __new__.  Attached example shows 'dictresize(mp, 0)' being called with 'mp' being dictionary of 10 items.  This causes an infinite uninterruptible loop.

----------
components: Interpreter Core
files: x.py
messages: 174009
nosy: arigo
priority: normal
severity: normal
status: open
title: dict.fromkeys() assumes 'self' is empty
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27758/x.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16345>
_______________________________________


More information about the New-bugs-announce mailing list