Skip to content

Commit 4e69faf

Browse files
authored
Merge branch 'main' into run-pidfdchildwatcher-on-the-running-loop
2 parents 1037078 + d3a27e4 commit 4e69faf

10 files changed

Lines changed: 25 additions & 89 deletions

File tree

Doc/library/gzip.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ The module defines the following items:
165165
.. versionchanged:: 3.6
166166
Accepts a :term:`path-like object`.
167167

168+
.. versionchanged:: 3.12
169+
Remove the ``filename`` attribute, use the :attr:`~GzipFile.name`
170+
attribute instead.
171+
168172
.. deprecated:: 3.9
169173
Opening :class:`GzipFile` for writing without specifying the *mode*
170174
argument is deprecated.

Doc/library/ssl.rst

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -311,27 +311,6 @@ Random generation
311311

312312
.. versionadded:: 3.3
313313

314-
.. function:: RAND_pseudo_bytes(num)
315-
316-
Return (bytes, is_cryptographic): bytes are *num* pseudo-random bytes,
317-
is_cryptographic is ``True`` if the bytes generated are cryptographically
318-
strong. Raises an :class:`SSLError` if the operation is not supported by the
319-
current RAND method.
320-
321-
Generated pseudo-random byte sequences will be unique if they are of
322-
sufficient length, but are not necessarily unpredictable. They can be used
323-
for non-cryptographic purposes and for certain purposes in cryptographic
324-
protocols, but usually not for key generation etc.
325-
326-
For almost all applications :func:`os.urandom` is preferable.
327-
328-
.. versionadded:: 3.3
329-
330-
.. deprecated:: 3.6
331-
332-
OpenSSL has deprecated :func:`ssl.RAND_pseudo_bytes`, use
333-
:func:`ssl.RAND_bytes` instead.
334-
335314
.. function:: RAND_status()
336315

337316
Return ``True`` if the SSL pseudo-random number generator has been seeded
@@ -2717,8 +2696,8 @@ for example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules),
27172696
be aware that OpenSSL's internal random number generator does not properly
27182697
handle forked processes. Applications must change the PRNG state of the
27192698
parent process if they use any SSL feature with :func:`os.fork`. Any
2720-
successful call of :func:`~ssl.RAND_add`, :func:`~ssl.RAND_bytes` or
2721-
:func:`~ssl.RAND_pseudo_bytes` is sufficient.
2699+
successful call of :func:`~ssl.RAND_add` or :func:`~ssl.RAND_bytes` is
2700+
sufficient.
27222701

27232702

27242703
.. _ssl-tlsv1_3:

Doc/whatsnew/3.12.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ Removed
214214
also a static method.
215215
(Contributed by Victor Stinner in :gh:`94169`.)
216216

217+
* Remove the :func:`ssl.RAND_pseudo_bytes` function, deprecated in Python 3.6:
218+
use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead.
219+
(Contributed by Victor Stinner in :gh:`94199`.)
220+
221+
* :mod:`gzip`: Remove the ``filename`` attribute of :class:`gzip.GzipFile`,
222+
deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute
223+
instead. In write mode, the ``filename`` attribute added ``'.gz'`` file
224+
extension if it was not present.
225+
(Contributed by Victor Stinner in :gh:`94196`.)
226+
217227

218228
Porting to Python 3.12
219229
======================

Lib/gzip.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,6 @@ def __init__(self, filename=None, mode=None,
212212
if self.mode == WRITE:
213213
self._write_gzip_header(compresslevel)
214214

215-
@property
216-
def filename(self):
217-
import warnings
218-
warnings.warn("use the name attribute", DeprecationWarning, 2)
219-
if self.mode == WRITE and self.name[-3:] != ".gz":
220-
return self.name + ".gz"
221-
return self.name
222-
223215
@property
224216
def mtime(self):
225217
"""Last modification time read from stream, or None"""

Lib/ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
SSLSyscallError, SSLEOFError, SSLCertVerificationError
107107
)
108108
from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj
109-
from _ssl import RAND_status, RAND_add, RAND_bytes, RAND_pseudo_bytes
109+
from _ssl import RAND_status, RAND_add, RAND_bytes
110110
try:
111111
from _ssl import RAND_egd
112112
except ImportError:

Lib/test/test_ssl.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,6 @@ def test_random(self):
382382
% (v, (v and "sufficient randomness") or
383383
"insufficient randomness"))
384384

385-
with warnings_helper.check_warnings():
386-
data, is_cryptographic = ssl.RAND_pseudo_bytes(16)
387-
self.assertEqual(len(data), 16)
388-
self.assertEqual(is_cryptographic, v == 1)
389385
if v:
390386
data = ssl.RAND_bytes(16)
391387
self.assertEqual(len(data), 16)
@@ -394,8 +390,6 @@ def test_random(self):
394390

395391
# negative num is invalid
396392
self.assertRaises(ValueError, ssl.RAND_bytes, -5)
397-
with warnings_helper.check_warnings():
398-
self.assertRaises(ValueError, ssl.RAND_pseudo_bytes, -5)
399393

400394
ssl.RAND_add("this is a random string", 75.0)
401395
ssl.RAND_add(b"this is a random bytes object", 75.0)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:mod:`gzip`: Remove the ``filename`` attribute of :class:`gzip.GzipFile`,
2+
deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute
3+
instead. In write mode, the ``filename`` attribute added ``'.gz'`` file
4+
extension if it was not present. Patch by Victor Stinner.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove the :func:`ssl.RAND_pseudo_bytes` function, deprecated in Python 3.6:
2+
use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. Patch by Victor
3+
Stinner.

Modules/_ssl.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,24 +5158,6 @@ _ssl_RAND_bytes_impl(PyObject *module, int n)
51585158
return PySSL_RAND(module, n, 0);
51595159
}
51605160

5161-
/*[clinic input]
5162-
_ssl.RAND_pseudo_bytes
5163-
n: int
5164-
/
5165-
5166-
Generate n pseudo-random bytes.
5167-
5168-
Return a pair (bytes, is_cryptographic). is_cryptographic is True
5169-
if the bytes generated are cryptographically strong.
5170-
[clinic start generated code]*/
5171-
5172-
static PyObject *
5173-
_ssl_RAND_pseudo_bytes_impl(PyObject *module, int n)
5174-
/*[clinic end generated code: output=b1509e937000e52d input=58312bd53f9bbdd0]*/
5175-
{
5176-
PY_SSL_DEPRECATED("ssl.RAND_pseudo_bytes() is deprecated", 1, NULL);
5177-
return PySSL_RAND(module, n, 1);
5178-
}
51795161

51805162
/*[clinic input]
51815163
_ssl.RAND_status
@@ -5634,7 +5616,6 @@ static PyMethodDef PySSL_methods[] = {
56345616
_SSL__TEST_DECODE_CERT_METHODDEF
56355617
_SSL_RAND_ADD_METHODDEF
56365618
_SSL_RAND_BYTES_METHODDEF
5637-
_SSL_RAND_PSEUDO_BYTES_METHODDEF
56385619
_SSL_RAND_STATUS_METHODDEF
56395620
_SSL_GET_DEFAULT_VERIFY_PATHS_METHODDEF
56405621
_SSL_ENUM_CERTIFICATES_METHODDEF

Modules/clinic/_ssl.c.h

Lines changed: 1 addition & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)