Skip to content

Commit 695d47b

Browse files
authored
bpo-43785: Update bz2 document (GH-25351)
1 parent 8fa1489 commit 695d47b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Doc/library/bz2.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ The :mod:`bz2` module contains:
2525
* The :func:`compress` and :func:`decompress` functions for one-shot
2626
(de)compression.
2727

28-
All of the classes in this module may safely be accessed from multiple threads.
29-
3028

3129
(De)compression of files
3230
------------------------
@@ -140,6 +138,11 @@ All of the classes in this module may safely be accessed from multiple threads.
140138

141139
The *compresslevel* parameter became keyword-only.
142140

141+
.. versionchanged:: 3.10
142+
This class is thread unsafe in the face of multiple simultaneous
143+
readers or writers, just like its equivalent classes in :mod:`gzip` and
144+
:mod:`lzma` have always been.
145+
143146

144147
Incremental (de)compression
145148
---------------------------

Doc/library/lzma.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ interface supporting the ``.xz`` and legacy ``.lzma`` file formats used by the
1919
:program:`xz` utility, as well as raw compressed streams.
2020

2121
The interface provided by this module is very similar to that of the :mod:`bz2`
22-
module. However, note that :class:`LZMAFile` is *not* thread-safe, unlike
23-
:class:`bz2.BZ2File`, so if you need to use a single :class:`LZMAFile` instance
22+
module. Note that :class:`LZMAFile` and :class:`bz2.BZ2File` are *not*
23+
thread-safe, so if you need to use a single :class:`LZMAFile` instance
2424
from multiple threads, it is necessary to protect it with a lock.
2525

2626

Doc/whatsnew/3.10.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,11 @@ Optimizations
10131013
:func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` and :func:`float`.
10141014
(Contributed by Dong-hee Na and Jeroen Demeyerin in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` and :issue:`41870`)
10151015
1016+
* :class:`BZ2File` performance is improved by removing internal ``RLock``.
1017+
This makes :class:`BZ2File` thread unsafe in the face of multiple simultaneous
1018+
readers or writers, just like its equivalent classes in :mod:`gzip` and
1019+
:mod:`lzma` have always been. (Contributed by Inada Naoki in :issue:`43785`).
1020+
10161021
Deprecated
10171022
==========
10181023

0 commit comments

Comments
 (0)