This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ssl.RAND_status docs describe it as returning True/False; actually returns 1/0
Type: behavior Stage: resolved
Components: Documentation, SSL Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: ZackerySpytz, christian.heimes, docs@python, josh.r, xtreak
Priority: low Keywords: patch

Created on 2018-10-30 13:40 by josh.r, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20063 merged ZackerySpytz, 2020-05-13 01:00
Messages (3)
msg328917 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2018-10-30 13:40
The ssl.RAND_status online docs say (with code format on True/False):

"Return True if the SSL pseudo-random number generator has been seeded with ‘enough’ randomness, and False otherwise."

This is incorrect; the function actually returns 1 or 0 (and the docstring agrees).

Fix can be one of:

1. Update docs to be less specific about the return type (use true/false, not True/False)
2. Update docs to match docstring (which specifically says 1/0, not True/False)
3. Update implementation and docstring to actually return True/False (replacing PyLong_FromLong with PyBool_FromLong and changing docstring to use True/False to match online docs)

#3 involves a small amount of code churn, but it also means we're not needlessly replicating a C API's use of int return values when the function is logically bool (there is no error status for the C API AFAICT, so it's not like returning int gains us anything on flexibility). bool would be mathematically equivalent to the original 1/0 return value in the rare cases someone uses it mathematically.
msg391702 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-04-23 16:08
New changeset 7d37b86ad48368cf93440ca220b758696730d0e5 by Zackery Spytz in branch 'master':
bpo-35114: Make ssl.RAND_status() return a bool (GH-20063)
msg391703 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-04-23 16:08
Thanks Zackery!
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79295
2021-04-23 16:08:16christian.heimessetstatus: open -> closed
versions: + Python 3.10
nosy: christian.heimes, docs@python, josh.r, ZackerySpytz, xtreak
messages: + msg391703

resolution: fixed
stage: patch review -> resolved
2021-04-23 16:08:02christian.heimessetnosy: + christian.heimes
messages: + msg391702
2020-05-13 01:00:35ZackerySpytzsetkeywords: + patch
nosy: + ZackerySpytz

pull_requests: + pull_request19372
stage: patch review
2018-11-01 07:45:34xtreaksetnosy: + xtreak
2018-10-30 13:40:17josh.rcreate