[issue19332] Guard against changing dict during iteration

2013-11-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Duplicate of this: http://bugs.python.org/issue6017 -- nosy: +stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332 ___

[issue19332] Guard against changing dict during iteration

2013-11-06 Thread Steven D'Aprano
Changes by Steven D'Aprano steve+pyt...@pearwood.info: -- nosy: -stevenjd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332 ___ ___

[issue19332] Guard against changing dict during iteration

2013-11-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: A few thoughts: * No existing, working code will benefit from this patch; however, almost all code will pay a price for it -- bigger size for an empty dict and a runtime cost (possibly very small) on the critical path (every time a value is stored in a

[issue19332] Guard against changing dict during iteration

2013-10-30 Thread Ethan Furman
Ethan Furman added the comment: Raymond, please don't be so concise. Is the code unimportant because the scenario is so rare, or something else? -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332

[issue19332] Guard against changing dict during iteration

2013-10-28 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332 ___

[issue19332] Guard against changing dict during iteration

2013-10-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: I disagree with adding such unimportant code to the critical path. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332 ___

[issue19332] Guard against changing dict during iteration

2013-10-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In the first patch the counter was placed in the _dictkeysobject structure. In the second place it is placed in the PyDictObject so it now has no memory cost. Access time to new counter for non-modifying operations is same as in current code. The only

[issue19332] Guard against changing dict during iteration

2013-10-23 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19332 ___ ___ Python-bugs-list

[issue19332] Guard against changing dict during iteration

2013-10-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: If there's no performance regression, then this sounds like a reasonable idea. The remaining question would be whether it can break existing code. Perhaps you should ask python-dev? -- ___ Python tracker

[issue19332] Guard against changing dict during iteration

2013-10-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: The decision to not monitor adding or removing keys was intentional. It is just not worth the cost in either time or space. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org

[issue19332] Guard against changing dict during iteration

2013-10-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Currently dict iterating is guarded against changing dict's size. However when dict changed during iteration so that it's size left unchanged, this modification left unnoticed. d = dict.fromkeys('abcd') for i in d: ... print(i) ... d[i + 'x'] =