Stefan Krah <stefan-use...@bytereef.org> added the comment: Marc-Andre Lemburg <rep...@bugs.python.org> wrote: > > Marc-Andre Lemburg <m...@egenix.com> added the comment: > > Could you try the same in Python 2.7 ?
It's the same, just in stringobject.c. Many hash functions have this issue. > The overflow is intended (after all, it's a hash function), but we should > probably add a cast to Py_hash_t to the hash building line in order to make > the compiler aware of this. I think I'd just do the hash calculation in unsigned and cast at the end of the function. For the conversion from unsigned to signed we'd still rely on implementation defined behavior [1], but at least the signed integer overflow would be gone. [1] Mark Dickinson made an effort to document assumptions for unsigned to signed conversions. I don't know if this has found its way it into the developer docs: http://mail.python.org/pipermail/python-dev/2009-December/094388.html ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11167> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com