[Python-Dev] Make str/bytes hash algorithm pluggable? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Mon Oct 7 03:36:40 CEST 2013


On 4 Oct 2013 07:17, "Guido van Rossum" <guido at python.org> wrote:

On Thu, Oct 3, 2013 at 2:13 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

On 4 Oct 2013 06:08, "Victor Stinner" <victor.stinner at gmail.com> wrote: > > 2013/10/3 Christian Heimes <christian at python.org>: > > A hash algorithm can be added and one avaible hash > > algorithm can be set before PyInitialize() is called for the first > > time. > > "PyInitialize" is not the good guard. Try for example "python3 -X > faulthandler": PyObjectHash() is called before PyInitialize() to add > "faulthandler" key into sys.xoptions dictionary. > > Today many Python internal functions are used before Python is > initialized... See the PEP 432 which proposes to improve the > situation: > http://www.python.org/dev/peps/pep-0432/ That problem exists because our main function doesn't follow the C API usage rules, though. We require other embedding applications to be better behaved than that if they want support :) That said, while I'm mostly in favour of the PEP, I think setting the algorithm should be a private API for 3.4. I do agree that since the platform support for SipHash is slightly narrower, we need to keep the existing hash algorithm around, make it relatively easy to enable and ensure we continue to test it on the build bots. I believe that last requirement for buildbot testing is the one that should drive the design of the private configuration API. I'll defer to Nick for approval of this PEP.

Sure, I'm happy to be BDFL delegate for this one. Christian, go ahead and add the appropriate header to the PEP.

Cheers, Nick.

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20131007/133865b0/attachment-0001.html>



More information about the Python-Dev mailing list