[Python-checkins] bpo-43785: Update bz2 document (GH-25351)

methane webhook-mailer at python.org
Tue Apr 13 19:23:11 EDT 2021


https://github.com/python/cpython/commit/695d47b51e3e197de5448a1eb2f618bef6d59ac8
commit: 695d47b51e3e197de5448a1eb2f618bef6d59ac8
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: methane <songofacandy at gmail.com>
date: 2021-04-14T08:22:49+09:00
summary:

bpo-43785: Update bz2 document (GH-25351)

files:
M Doc/library/bz2.rst
M Doc/library/lzma.rst
M Doc/whatsnew/3.10.rst

diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index 637baf49da1fc..f6787ab120ed5 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -25,8 +25,6 @@ The :mod:`bz2` module contains:
 * The :func:`compress` and :func:`decompress` functions for one-shot
   (de)compression.
 
-All of the classes in this module may safely be accessed from multiple threads.
-
 
 (De)compression of files
 ------------------------
@@ -140,6 +138,11 @@ All of the classes in this module may safely be accessed from multiple threads.
 
       The *compresslevel* parameter became keyword-only.
 
+   .. versionchanged:: 3.10
+      This class is thread unsafe in the face of multiple simultaneous
+      readers or writers, just like its equivalent classes in :mod:`gzip` and
+      :mod:`lzma` have always been.
+
 
 Incremental (de)compression
 ---------------------------
diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst
index 633c87873cd8c..21092645366da 100644
--- a/Doc/library/lzma.rst
+++ b/Doc/library/lzma.rst
@@ -19,8 +19,8 @@ interface supporting the ``.xz`` and legacy ``.lzma`` file formats used by the
 :program:`xz` utility, as well as raw compressed streams.
 
 The interface provided by this module is very similar to that of the :mod:`bz2`
-module. However, note that :class:`LZMAFile` is *not* thread-safe, unlike
-:class:`bz2.BZ2File`, so if you need to use a single :class:`LZMAFile` instance
+module. Note that :class:`LZMAFile` and :class:`bz2.BZ2File` are *not*
+thread-safe, so if you need to use a single :class:`LZMAFile` instance
 from multiple threads, it is necessary to protect it with a lock.
 
 
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 6af0f834a9d4c..e0e7d19577e2b 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -1013,6 +1013,11 @@ Optimizations
   :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` and :func:`float`.
   (Contributed by Dong-hee Na and Jeroen Demeyerin in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` and :issue:`41870`)
 
+* :class:`BZ2File` performance is improved by removing internal ``RLock``.
+  This makes :class:`BZ2File` thread unsafe in the face of multiple simultaneous
+  readers or writers, just like its equivalent classes in :mod:`gzip` and
+  :mod:`lzma` have always been.  (Contributed by Inada Naoki in :issue:`43785`).
+
 Deprecated
 ==========
 



More information about the Python-checkins mailing list