Skip to content

Commit 26d8a3c

Browse files
authored
Deprecate the rand module (#1325)
refs #1321
1 parent 2ef4571 commit 26d8a3c

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ Changelog
44
Versions are year-based with a strict backward-compatibility policy.
55
The third digit is only for regressions.
66

7+
24.3.0 (UNRELEASED)
8+
-------------------
9+
10+
Backward-incompatible changes:
11+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
Deprecations:
14+
^^^^^^^^^^^^^
15+
16+
- Deprecated ``OpenSSL.rand`` - callers should use ``os.urandom()`` instead.
17+
18+
Changes:
19+
^^^^^^^^
20+
21+
722
24.2.1 (2024-07-20)
823
-------------------
924

src/OpenSSL/rand.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
PRNG management routines, thin wrappers.
33
"""
44

5+
import warnings
6+
57
from OpenSSL._util import lib as _lib
68

9+
warnings.warn(
10+
"OpenSSL.rand is deprecated - you should use os.urandom instead",
11+
DeprecationWarning,
12+
stacklevel=3,
13+
)
14+
715

816
def add(buffer: bytes, entropy: int) -> None:
917
"""

0 commit comments

Comments
 (0)