]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40286: Add randbytes() method to random.Random (GH-19527)
authorVictor Stinner <vstinner@python.org>
Fri, 17 Apr 2020 17:05:35 +0000 (19:05 +0200)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 17:05:35 +0000 (19:05 +0200)
commit9f5fe7910f4a1bf5a425837d4915e332b945eb7b
tree5f652699332e33a81cf6baa5ff5b6fecadea1903
parent22386bb4ef740ee92d34c87b8cb90d681423a853
bpo-40286: Add randbytes() method to random.Random (GH-19527)

Add random.randbytes() function and random.Random.randbytes()
method to generate random bytes.

Modify secrets.token_bytes() to use SystemRandom.randbytes()
rather than calling directly os.urandom().

Rename also genrand_int32() to genrand_uint32(), since it returns an
unsigned 32-bit integer, not a signed integer.

The _random module is now built with Py_BUILD_CORE_MODULE defined.
Doc/library/random.rst
Doc/whatsnew/3.9.rst
Lib/random.py
Lib/secrets.py
Lib/test/test_random.py
Misc/NEWS.d/next/Library/2020-04-15-00-39-25.bpo-40286.ai80FA.rst [new file with mode: 0644]
Modules/Setup
Modules/_randommodule.c
Modules/clinic/_randommodule.c.h
setup.py