This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients Zooko.Wilcox-O'Hearn, christian.heimes, corona10, jstasiak, kmaork, larry, mgorny, oconnor663, xtreak
Date 2022-03-22.12:36:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647952565.56.0.342649628454.issue39298@roundup.psfhosted.org>
In-reply-to
Content
Jack: I've updated the PR, improving compatibility with the "blake3" package on PyPI.  I took your notes, and also looked at the C module you wrote.

The resulting commit is here:

https://github.com/python/cpython/pull/31686/commits/37ce72b0444ad63fd1989ad36be5f7790e51f4f1

Specifically:

* derive_key_context is now a string, which I internally encode into UTF-8.

* I added the AUTO member to the module, set to -1.

* max_threads may not be zero; it can be >= 1 or AUTO.

* I added the reset() method.


Some additional thoughts, both on what I did and on what you did:

* In your new() method, your error string says "keys must be 32 bytes".  I went with "key must be exactly 32 bytes"; the name of the parameter is "key", and I think "exactly" makes the message clearer.

* In my new() method, I complain if the derive_key_context is zero-length.  In your opinion, is that a good idea, or is that overly fussy?

* In your copy() method, you hard-code Blake3Type.  It's considered good form to use type(self) here, in case the user is calling copy on a user-created subclass of Blake3Type.

* In your copy() method, if the original has a lock created, you create a lock in the copy too.  I'm not sure why you bother; I leave the lock member uninitialized, and let the existing logic create the lock in the copy on demand.

* In the Blake3_methods array, you list the "update" method twice.  I suspect this is totally harmless, but it's unnecessary.
History
Date User Action Args
2022-03-22 12:36:05larrysetrecipients: + larry, christian.heimes, mgorny, Zooko.Wilcox-O'Hearn, jstasiak, oconnor663, corona10, xtreak, kmaork
2022-03-22 12:36:05larrysetmessageid: <1647952565.56.0.342649628454.issue39298@roundup.psfhosted.org>
2022-03-22 12:36:05larrylinkissue39298 messages
2022-03-22 12:36:05larrycreate