Skip to content

bpo-35114: Make ssl.RAND_status() return a bool (GH-20063) #20063

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

Merged
merged 5 commits into from
Apr 23, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:func:`ssl.RAND_status` now returns a boolean value (as documented) instead
of ``1`` or ``0``.
6 changes: 3 additions & 3 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4971,17 +4971,17 @@ _ssl_RAND_pseudo_bytes_impl(PyObject *module, int n)
/*[clinic input]
_ssl.RAND_status

Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.
Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.

It is necessary to seed the PRNG with RAND_add() on some platforms before
using the ssl() function.
[clinic start generated code]*/

static PyObject *
_ssl_RAND_status_impl(PyObject *module)
/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=8a774b02d1dc81f3]*/
/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=d5ae5aea52f36e01]*/
{
return PyLong_FromLong(RAND_status());
return PyBool_FromLong(RAND_status());
}

/*[clinic input]
Expand Down
4 changes: 2 additions & 2 deletions Modules/clinic/_ssl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.