Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-43669: Drop the internal _sha3 module per PEP 644 #28768

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Python/ast_opt.c @isidentical
**/*md5* @python/crypto-team @tiran
**/*blake* @python/crypto-team @tiran
/Modules/_blake2/** @python/crypto-team @tiran
/Modules/_sha3/** @python/crypto-team @tiran

# logging
**/*logging* @vsajip
Expand Down
10 changes: 0 additions & 10 deletions Lib/hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ def __get_builtin_constructor(name):
import _blake2
cache['blake2b'] = _blake2.blake2b
cache['blake2s'] = _blake2.blake2s
elif name in {'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512'}:
import _sha3
cache['sha3_224'] = _sha3.sha3_224
cache['sha3_256'] = _sha3.sha3_256
cache['sha3_384'] = _sha3.sha3_384
cache['sha3_512'] = _sha3.sha3_512
elif name in {'shake_128', 'shake_256'}:
import _sha3
cache['shake_128'] = _sha3.shake_128
cache['shake_256'] = _sha3.shake_256
except ImportError:
pass # no extension module, this hash is unsupported.

Expand Down
14 changes: 2 additions & 12 deletions Lib/test/test_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')

# default builtin hash module
default_builtin_hashes = {'md5', 'sha1', 'sha256', 'sha512', 'sha3', 'blake2'}
default_builtin_hashes = {'md5', 'sha1', 'sha256', 'sha512', 'blake2'}
# --with-builtin-hashlib-hashes override
builtin_hashes = sysconfig.get_config_var("PY_BUILTIN_HASHLIB_HASHES")
if builtin_hashes is None:
Expand Down Expand Up @@ -174,15 +174,6 @@ def add_builtin_constructor(name):
add_builtin_constructor('blake2s')
add_builtin_constructor('blake2b')

_sha3 = self._conditional_import_module('_sha3')
if _sha3:
add_builtin_constructor('sha3_224')
add_builtin_constructor('sha3_256')
add_builtin_constructor('sha3_384')
add_builtin_constructor('sha3_512')
add_builtin_constructor('shake_128')
add_builtin_constructor('shake_256')

super(HashLibTestCase, self).__init__(*args, **kwargs)

@property
Expand Down Expand Up @@ -407,8 +398,7 @@ def check_blocksize_name(self, name, block_size=0, digest_size=0,
self.assertEqual(len(m.digest()), digest_size)
self.assertEqual(len(m.hexdigest()), 2*digest_size)
self.assertEqual(m.name, name)
# split for sha3_512 / _sha3.sha3 object
self.assertIn(name.split("_")[0], repr(m))
self.assertIn(name, repr(m))

def test_blocksize_name(self):
self.check_blocksize_name('md5', 64, 16)
Expand Down
1 change: 0 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ coverage-lcov:
'*/Modules/_blake2/impl/*' \
'*/Modules/_ctypes/libffi*/*' \
'*/Modules/_decimal/libmpdec/*' \
'*/Modules/_sha3/kcp/*' \
'*/Modules/expat/*' \
'*/Modules/zlib/*' \
'*/Include/*' \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop the internal _sha3 module per PEP 644. Patch by Illia Volochii.
1 change: 0 additions & 1 deletion Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ _symtable symtablemodule.c
#_sha1 sha1module.c
#_sha256 sha256module.c -DPy_BUILD_CORE_BUILTIN
#_sha512 sha512module.c -DPy_BUILD_CORE_BUILTIN
#_sha3 _sha3/sha3module.c

# _blake module
#_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
Expand Down
11 changes: 0 additions & 11 deletions Modules/_sha3/README.txt

This file was deleted.

50 changes: 0 additions & 50 deletions Modules/_sha3/cleanup.py

This file was deleted.

167 changes: 0 additions & 167 deletions Modules/_sha3/clinic/sha3module.c.h

This file was deleted.

82 changes: 0 additions & 82 deletions Modules/_sha3/kcp/KeccakHash.c

This file was deleted.

Loading