summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorJürgen Gmach <juergen.gmach@googlemail.com>2021-05-18 16:11:23 (GMT)
committerGitHub <noreply@github.com>2021-05-18 16:11:23 (GMT)
commit02ee8191263848f8c8999f72286148946b83e5c9 (patch)
tree085154e904b82f135e48cb8b7a991d2115e22e53 /Lib/configparser.py
parent115dea9e2602b96b63390f00cc880e90c433efa2 (diff)
downloadcpython-02ee8191263848f8c8999f72286148946b83e5c9.zip
cpython-02ee8191263848f8c8999f72286148946b83e5c9.tar.gz
cpython-02ee8191263848f8c8999f72286148946b83e5c9.tar.bz2
bpo-41963: document that ConfigParser strips off comments (GH-26197)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Laura Gutierrez Funderburk <58710704+lgfunderburk@users.noreply.github.com>
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 3b4cb5e..2f45e24 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -908,6 +908,9 @@ class RawConfigParser(MutableMapping):
If `space_around_delimiters' is True (the default), delimiters
between keys and values are surrounded by spaces.
+
+ Please note that comments in the original configuration file are not
+ preserved when writing the configuration back.
"""
if space_around_delimiters:
d = " {} ".format(self._delimiters[0])
@@ -1006,7 +1009,7 @@ class RawConfigParser(MutableMapping):
Configuration files may include comments, prefixed by specific
characters (`#' and `;' by default). Comments may appear on their own
in an otherwise empty line or may be entered in lines holding values or
- section names.
+ section names. Please note that comments get stripped off when reading configuration files.
"""
elements_added = set()
cursect = None # None, or a dictionary