Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

configparser throws TypeError for combination of interpolation and allow_no_value #130941

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@dabuahoid

Description

@dabuahoid

Bug report

Bug description:

The configparser modules throws an Exception as:

Traceback (most recent call last):  File "test.py", line 4, in <module>    config.get("dummy", "b")  File "python3.12/configparser.py", line 777, in get    return self._interpolation.before_get(self, section, option, value,           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "python3.12/configparser.py", line 428, in before_get    self._interpolate_some(parser, option, L, value, section, defaults, 1)  File "python3.12/configparser.py", line 481, in _interpolate_some    if "$" in v:       ^^^^^^^^TypeError: argument of type 'NoneType' is not iterable

when using:

config.ini

[dummy]ab = ${a}

and following ConfigParser settings:

test.py

importconfigparserconfig=configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation(),allow_no_value=True)config.read("config.ini")config.get("dummy","b")

Since the value of a is None the interpolation should convert the reference first to an empty string to keep interpolation alive.
Expected value for b would be an empty string.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux, Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp