Author josh.r
Recipients docs@python, josh.r
Date 2018-10-30.13:40:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540906817.06.0.788709270274.issue35114@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-10-30 13:40:17josh.rsetrecipients: + josh.r, docs@python
2018-10-30 13:40:17josh.rsetmessageid: <1540906817.06.0.788709270274.issue35114@psf.upfronthosting.co.za>
2018-10-30 13:40:16josh.rlinkissue35114 messages
2018-10-30 13:40:16josh.rcreate