configparser: allow default_section=None by ekanshul · Pull Request #16262 · python/typeshed · GitHub
Skip to content

configparser: allow default_section=None - #16262

Open
ekanshul wants to merge 2 commits into
python:mainfrom
ekanshul:configparser-default-section-none
Open

configparser: allow default_section=None#16262
ekanshul wants to merge 2 commits into
python:mainfrom
ekanshul:configparser-default-section-none

Conversation

@ekanshul

Copy link
Copy Markdown
Contributor

Closes #12700

Widen RawConfigParser.default_section and the default_section parameter of RawConfigParser.__init__ to str | None, since passing None works at runtime to disable the default section and is relied on in the wild (e.g. setuptools).

Agent used: Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Comment thread stdlib/configparser.pyi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A problem with this is that if default_section is given as None, you will get None in __iter__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should None be an acceptable default_section parameter of configparser.ConfigParser

3 participants