[Python-checkins] bpo-35114: Make ssl.RAND_status() return a bool (GH-20063)

tiran webhook-mailer at python.org
Fri Apr 23 12:08:03 EDT 2021


https://github.com/python/cpython/commit/7d37b86ad48368cf93440ca220b758696730d0e5
commit: 7d37b86ad48368cf93440ca220b758696730d0e5
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: tiran <christian at python.org>
date: 2021-04-23T18:07:37+02:00
summary:

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

files:
A Misc/NEWS.d/next/Library/2020-05-17-14-10-24.bpo-35114.uLIHfn.rst
M Modules/_ssl.c
M Modules/clinic/_ssl.c.h

diff --git a/Misc/NEWS.d/next/Library/2020-05-17-14-10-24.bpo-35114.uLIHfn.rst b/Misc/NEWS.d/next/Library/2020-05-17-14-10-24.bpo-35114.uLIHfn.rst
new file mode 100644
index 00000000000000..e1d57f597bd466
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-05-17-14-10-24.bpo-35114.uLIHfn.rst
@@ -0,0 +1,2 @@
+:func:`ssl.RAND_status` now returns a boolean value (as documented) instead
+of ``1`` or ``0``.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 0daa13e92d6a7e..abc5c2cfa1a790 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -5035,7 +5035,7 @@ _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.
@@ -5043,9 +5043,9 @@ using the ssl() function.
 
 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]
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index 45c3095a9f6f00..c209c63c022565 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -1088,7 +1088,7 @@ PyDoc_STRVAR(_ssl_RAND_status__doc__,
 "RAND_status($module, /)\n"
 "--\n"
 "\n"
-"Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n"
+"Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.\n"
 "\n"
 "It is necessary to seed the PRNG with RAND_add() on some platforms before\n"
 "using the ssl() function.");
@@ -1324,4 +1324,4 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
 #ifndef _SSL_ENUM_CRLS_METHODDEF
     #define _SSL_ENUM_CRLS_METHODDEF
 #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=83e68c77bd96789a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=8736d838c9059151 input=a9049054013a1b77]*/



More information about the Python-checkins mailing list