summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2011-10-31 18:34:46 (GMT)
committerRoss Lagerwall <rosslagerwall@gmail.com>2011-10-31 18:34:46 (GMT)
commit59142db6d35f00142cd9982878e75d43cbda7a68 (patch)
treecf1d1ca5ffda256d0b9fe259c7c5726d3e897482 /Doc/library/io.rst
parentab06e3f285ae61e5abc48b350034c94b7d624fda (diff)
downloadcpython-59142db6d35f00142cd9982878e75d43cbda7a68.zip
cpython-59142db6d35f00142cd9982878e75d43cbda7a68.tar.gz
cpython-59142db6d35f00142cd9982878e75d43cbda7a68.tar.bz2
Issue #12797: Added custom opener parameter to builtin open() and FileIO.open().
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 0bcf687..1da7e4c 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -458,7 +458,7 @@ I/O Base Classes
Raw File I/O
^^^^^^^^^^^^
-.. class:: FileIO(name, mode='r', closefd=True)
+.. class:: FileIO(name, mode='r', closefd=True, opener=None)
:class:`FileIO` represents an OS-level file containing bytes data.
It implements the :class:`RawIOBase` interface (and therefore the
@@ -479,6 +479,15 @@ Raw File I/O
The :meth:`read` (when called with a positive argument), :meth:`readinto`
and :meth:`write` methods on this class will only make one system call.
+ A custom opener can be used by passing a callable as *opener*. The underlying
+ file descriptor for the file object is then obtained by calling *opener* with
+ (*name*, *flags*). *opener* must return an open file descriptor (passing
+ :mod:`os.open` as *opener* results in functionality similar to passing
+ ``None``).
+
+ .. versionchanged:: 3.3
+ The *opener* parameter was added.
+
In addition to the attributes and methods from :class:`IOBase` and
:class:`RawIOBase`, :class:`FileIO` provides the following data
attributes and methods: