8000 gh-107625: configparser: Raise ParsingError if a key contains empty value by Agent-Hellboy · Pull Request #107651 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107625: configparser: Raise ParsingError if a key contains empty value #107651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix doc
  • Loading branch information
Agent-Hellboy committed Aug 5, 2023
commit 778841d3572d96a09f8f68e55ee10a7873376f3c
12 changes: 6 additions & 6 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1030,18 +1030,18 @@ ConfigParser Objects
directory), and all existing configuration files in the iterable 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
optional files::

Raise :exc:`ParsingError` instead of :exc:`AttributeError`
when the configuration contains a key without a corresponding value.
This change is intended to handle scenarios where a key lacks a value
in a configuration which contains extra space or newline within a section.
Please note that it's not recommended to have extra spaces
or blank lines within sections of the configuration.

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
optional files::

import configparser, os

Expand Down
0