]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.6] bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346) (GH-8581...
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 11 Oct 2018 04:56:06 +0000 (07:56 +0300)
committerGitHub <noreply@github.com>
Thu, 11 Oct 2018 04:56:06 +0000 (07:56 +0300)
commitf543e18708efb04ed3a0b78c8dc31fbb1404ac7d
treec5fc0d4eb467155aa4aceb7a34c98948fdfc12b9
parent3baee3b39765f5e8ec616b2b71b731b140486394
[3.6] bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346) (GH-8581) (GH-9657)

* help(hashlib) didn't work because of incorrect module name in blake2b and
  blake2s classes.
* Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly
  accepted keyword argument "string" for binary data, but documented as
  accepting the "data" keyword argument. Now this parameter is positional-only.
* Keyword-only parameters in blake2b() and blake2s() were not documented as
  keyword-only.
* Default value for some parameters of blake2b() and blake2s() was None,
  which is not acceptable value.
* The length argument for shake_*.digest() was wrapped out to 32 bits.
* The argument for shake_128.digest() and shake_128.hexdigest() was not
  positional-only as intended.
* TypeError messages for incorrect arguments in all constructors sha3_*(),
  shake_*() and keccak_*() incorrectly referred to sha3_224.

Also made the following enhancements:

* More accurately specified input and result types for strings, bytes and
  bytes-like objects.
* Unified positional parameter names for update() and constructors.
* Improved formatting.
(cherry picked from commit f1d36d8efaecd5c84cb35e35119b283f37d83c40)
(cherry picked from commit 47957dab94a4efa2fee61c9a8193f78300950769)
Doc/library/hashlib.rst
Lib/hashlib.py
Lib/test/test_hashlib.py
Misc/NEWS.d/next/Library/2018-07-20-09-11-05.bpo-33729.sO6iTb.rst [new file with mode: 0644]
Modules/_blake2/blake2b_impl.c
Modules/_blake2/blake2s_impl.c
Modules/_blake2/clinic/blake2b_impl.c.h
Modules/_blake2/clinic/blake2s_impl.c.h
Modules/_hashopenssl.c
Modules/_sha3/clinic/sha3module.c.h
Modules/_sha3/sha3module.c