diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-03-03 17:48:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-03 17:48:37 (GMT) |
commit | 21ce65aa67f0dc63002ab0a5fb21ef921cf5279e (patch) | |
tree | 57a9bf2020d05d6e89f70fabe5b80852a26634e3 /Doc/library | |
parent | c7ff163abf428d73d4054754db3c99d06487e3ad (diff) | |
download | cpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.zip cpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.tar.gz cpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.tar.bz2 |
[3.6] bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) (#432)
(cherry picked from commit 85b8d01c916b482dac937b93ede1e53b1db0361c)
Conflicts:
Lib/test/test_configparser.py
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/configparser.rst | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index e09562d..af57cba 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -983,13 +983,16 @@ ConfigParser Objects .. method:: read(filenames, encoding=None) Attempt to read and parse a list of filenames, returning a list of - filenames which were successfully parsed. If *filenames* is a string, it - is treated as a single filename. If a file named in *filenames* cannot - be opened, that file will be ignored. This is designed so that you can - specify a list of potential configuration file locations (for example, - the current directory, the user's home directory, and some system-wide - directory), and all existing configuration files in the list will be - read. If none of the named files exist, the :class:`ConfigParser` + filenames which were successfully parsed. + + If *filenames* is a string or :term:`path-like object`, it is treated as + a single filename. If a file named in *filenames* cannot be opened, that + file will be ignored. This is designed so that you can specify a list of + potential configuration file locations (for example, the current + directory, the user's home directory, and some system-wide directory), + and all existing configuration files in the list will be read. + + If none of the named files exist, the :class:`ConfigParser` instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using :meth:`read_file` before calling :meth:`read` for any @@ -1006,6 +1009,9 @@ ConfigParser Objects The *encoding* parameter. Previously, all files were read using the default encoding for :func:`open`. + .. versionadded:: 3.6.1 + The *filenames* parameter accepts a :term:`path-like object`. + .. method:: read_file(f, source=None) |