]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35114: Make ssl.RAND_status() return a bool (GH-20063)
authorZackery Spytz <zspytz@gmail.com>
Fri, 23 Apr 2021 16:07:37 +0000 (10:07 -0600)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 16:07:37 +0000 (18:07 +0200)
Misc/NEWS.d/next/Library/2020-05-17-14-10-24.bpo-35114.uLIHfn.rst [new file with mode: 0644]
Modules/_ssl.c
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 (file)
index 0000000..e1d57f5
--- /dev/null
@@ -0,0 +1,2 @@
+:func:`ssl.RAND_status` now returns a boolean value (as documented) instead
+of ``1`` or ``0``.
index 0daa13e92d6a7e5bb5bdb1da3c16b627814b4540..abc5c2cfa1a7906422602dc1502fd6fb56caaf58 100644 (file)
@@ -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]
index 45c3095a9f6f004c736b40e171f00712c4762c4a..c209c63c02256569e89ddbedf579ebe23f355a3d 100644 (file)
@@ -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 @@ exit:
 #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]*/