diff --git a/Lib/configparser.py b/Lib/configparser.py index 3c452afe8ade48..089680bff521f8 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -885,13 +885,17 @@ def getboolean(self, section, option, *, raw=False, vars=None, raw=raw, vars=vars, fallback=fallback, **kwargs) def items(self, section=_UNSET, raw=False, vars=None): - """Return a list of (name, value) tuples for each option in a section. + """Return the items of the parser or of a section. - All % interpolations are expanded in the return values, based on the - defaults passed into the constructor, unless the optional argument - `raw` is true. Additional substitutions may be provided using the - `vars` argument, which must be a dictionary whose contents overrides - any pre-existing defaults. + When `section` is not given, return an ItemsView of + (section_name, section_proxy) pairs, including DEFAULTSECT. + + Otherwise, return a list of (name, value) tuples for each option in + the given section. All % interpolations are expanded in the return + values, based on the defaults passed into the constructor, unless the + optional argument `raw` is true. Additional substitutions may be + provided using the `vars` argument, which must be a dictionary whose + contents overrides any pre-existing defaults. The section DEFAULT is special. """ diff --git a/Misc/NEWS.d/next/Library/2026-06-28-02-25-40.gh-issue-150132.GzQh4n.rst b/Misc/NEWS.d/next/Library/2026-06-28-02-25-40.gh-issue-150132.GzQh4n.rst new file mode 100644 index 00000000000000..ebd18d81783181 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-06-28-02-25-40.gh-issue-150132.GzQh4n.rst @@ -0,0 +1,3 @@ +Document the no-argument form of :meth:`configparser.ConfigParser.items` in +its docstring; called without a section it returns a view of +``(section_name, section_proxy)`` pairs.