Make BZ2File's fileobj support easier to use.
The fileobj argument was added during the 3.3 development cycle, so this change
does not break backward compatibility with 3.2.
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index 9577f31..de5c825 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -26,17 +26,18 @@
(De)compression of files
------------------------
-.. class:: BZ2File(filename=None, mode='r', buffering=None, compresslevel=9, \*, fileobj=None)
+.. class:: BZ2File(filename, mode='r', buffering=None, compresslevel=9)
Open a bzip2-compressed file.
- The :class:`BZ2File` can wrap an existing :term:`file object` (given by
- *fileobj*), or operate directly on a named file (named by *filename*).
- Exactly one of these two parameters should be provided.
+ If *filename* is a :class:`str` or :class:`bytes` object, open the named file
+ directly. Otherwise, *filename* should be a :term:`file object`, which will
+ be used to read or write the compressed data.
The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for
- overwriting, or ``'a'`` for appending. If *fileobj* is provided, a mode of
- ``'w'`` does not truncate the file, and is instead equivalent to ``'a'``.
+ overwriting, or ``'a'`` for appending. If *filename* is a file object (rather
+ than an actual file name), a mode of ``'w'`` does not truncate the file, and
+ is instead equivalent to ``'a'``.
The *buffering* argument is ignored. Its use is deprecated.
@@ -69,7 +70,8 @@
:meth:`read1` and :meth:`readinto` methods were added.
.. versionchanged:: 3.3
- The *fileobj* argument to the constructor was added.
+ Support was added for *filename* being a :term:`file object` instead of an
+ actual filename.
.. versionchanged:: 3.3
The ``'a'`` (append) mode was added, along with support for reading