Message415761
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. |
|
Date |
User |
Action |
Args |
2022-03-22 12:36:05 | larry | set | recipients:
+ larry, christian.heimes, mgorny, Zooko.Wilcox-O'Hearn, jstasiak, oconnor663, corona10, xtreak, kmaork |
2022-03-22 12:36:05 | larry | set | messageid: <1647952565.56.0.342649628454.issue39298@roundup.psfhosted.org> |
2022-03-22 12:36:05 | larry | link | issue39298 messages |
2022-03-22 12:36:05 | larry | create | |
|