[New-bugs-announce] [issue14417] dict RuntimeError workaround

Jim Jewett report at bugs.python.org
Mon Mar 26 20:16:51 CEST 2012

New submission from Jim Jewett <jimjjewett at gmail.com>:

Per the 3.3 WhatsNew:
"""issue 14205: A dict lookup now raises a RuntimeError if the dict is modified during the lookup. If you implement your own comparison function for objects used as dict keys and the dict is shared by multiple threads, access to the dict should be protected by a lock."""

This should be easier to do.  My suggestion would be that the change to (general) lookdict (or possibly an additional transition, if you want a less-slow path for non-string non-container builtins) create the lock, and acquire/release that lock.  At a minimum, there should be a dict subclass that does this.

[Note that this is arguably a regression, since previous python versions would just retry, which would be enough to protect innocent but unlucky code.]

messages: 156843
nosy: Jim.Jewett
priority: normal
severity: normal
status: open
title: dict RuntimeError workaround
type: enhancement
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list