Skip to content

ConfigParser.items() does not normalize non-string vars like get() #160684

Description

@bugstan

Bug report

ConfigParser.items(..., vars=...) handles non-string overrides differently from get(), although the documented optional arguments have the same meaning.

import configparser

parser = configparser.ConfigParser()
parser.read_dict({'section': {'value': 'original'}})
print(parser.get('section', 'value', vars={'value': 42}))
print(parser.items('section', vars={'value': 42}))

On the current main branch, get() returns '42', but items() raises AttributeError: 'int' object has no attribute 'find'. With 0 or False, items() instead returns an empty string. With raw=True, it returns the unconverted override.

Expected: normalize non-None override values to strings, consistently with get().

CPython versions tested on:

CPython main branch (7b12a415c85d88eeb22a806b2bc9472d471b8e60, 3.16.0a1+dev).

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added a commit that references this issue on Oct 25, 2026
  2. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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