From 5bba7e4e748699f987374ee98539b63def7f5b36 Mon Sep 17 00:00:00 2001 From: kovan Date: Tue, 3 Feb 2026 22:49:02 +0100 Subject: [PATCH] gh-143700: Document secrets.DEFAULT_ENTROPY Add documentation for the DEFAULT_ENTROPY constant in the secrets module. Document it as an opaque value that may change at any time, encouraging users to explicitly pass nbytes if they need a specific amount of entropy. Co-Authored-By: Claude Opus 4.5 --- Doc/library/secrets.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/secrets.rst b/Doc/library/secrets.rst index 75dafc54d40ca5..cc0fb9a821a2b2 100644 --- a/Doc/library/secrets.rst +++ b/Doc/library/secrets.rst @@ -62,6 +62,14 @@ The :mod:`secrets` module provides functions for generating secure tokens, suitable for applications such as password resets, hard-to-guess URLs, and similar. +.. data:: DEFAULT_ENTROPY + + The default number of bytes of randomness used by the ``token_*`` + functions when *nbytes* is not specified. This is an opaque value + that may change at any time, including during maintenance releases. + Users who need a specific amount of entropy should explicitly pass + the *nbytes* argument. + .. function:: token_bytes([nbytes=None]) Return a random byte string containing *nbytes* number of bytes.