[issue14417] dict RuntimeError workaround

Guido van Rossum report at bugs.python.org
Sun Apr 1 06:00:02 CEST 2012


Guido van Rossum <guido at python.org> added the comment:

But the sleep(0.1) forces a thread switch so I consider that still cheating -- nobody in their right mind would consider calling sleep() inside __hash__.

You can probably get it to fail without this by just doing a bunch of random computation in the __hash__ (and using a low sys.setswitchinterval() value).  Or consider creating a key that consists of e.g. a tuple of 100 or 1000 Key instances -- hashing that will call the __hash__ on each of those, wasting a lot of cycles.

----------

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


More information about the Python-bugs-list mailing list