Message155199
| Author |
gvanrossum |
| Recipients |
Jim.Jewett, Mark.Shannon, gvanrossum, python-dev, rhettinger, vstinner |
| Date |
2012年03月09日.01:01:46 |
| SpamBayes Score |
9.14741e-09 |
| Marked as misclassified |
No |
| Message-id |
<CAP7+vJL6_gTbBE0swmkrz0a3Rcshp2A1pDfUfZC9hR2TvRq=3g@mail.gmail.com> |
| In-reply-to |
<CAMpsgwYHKRsr48zjMzbXzfO7dg8efmVvYw7hJEVU5poYeXmrRg@mail.gmail.com> |
| Content |
On Thu, Mar 8, 2012 at 4:56 PM, STINNER Victor <report@bugs.python.org> wrote:
>
> STINNER Victor <victor.stinner@gmail.com> added the comment:
>
>> Can you implement the counter without adding an extra field to the dict object?
>
> Add a counter requires to change the prototype of the C lookup function:
> PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, Py_hash_t hash);
>
> I don't know if it is a problem for ABI compatibility or extension
> modules. I suppose that it is safer and simpler to not change it :-)
Agreed.
>> I worry that we'll get the same objection we had when MAL proposed collision counting as a solution to the hash DoS attack.
>>
>> The numbers 0, 1 and infinity are special; all others are to be treated with skepticism.
>
> Is it really useful to only retry once? Retrying once means that it
> would work in most cases, but not in some corner cases. For example,
> retrying once may hide the problem if you have only 1 client (1
> thread), but you get the exception when you have more clients (more
> threads).
>
> Or do I misunderstand the problem?
Sorry, I was joking; anyway, 1 in this context would mean do the
lookup exactly once (so 0 would mean not to do it at all). One retry
would effectively mean try it twice, which would have to be treated
skeptically. :-)
Given all this I think we should keep it as you have committed and add
it to the docs and whatsnew. |
|